Issue with closest(".coral-Select"); in aem 6.5 | Adobe Higher Education
Skip to main content
guruprasadc9901
January 3, 2020

Issue with closest(".coral-Select"); in aem 6.5

  • January 3, 2020
  • 1 respuesta
  • 4168 visualizaciones

Hi team,
when am trying to get an value from drop down in selection field using closest(".coral-Select") getting an undefined value.
is there any change in aem 6.5? but it works fine in aem 6.3.
EX: var a = $("[name='./componentMode']").closest(".coral-Select");

if iam trying to print $("[name='./componentMode']") ,value is getting populated in console,when iam trying with $("[name='./componentMode']").closest(".coral-Select"); getting undefined in console.
can you suggest any solution.

Este tema ha sido cerrado para respuestas.

1 respuesta

arunpatidar
Community Advisor
Community Advisor
January 5, 2020

can you try with. you may be using granite components.

$("[name='./componentMode']").closest(".coral3-Select");

Arun Patidar
guruprasadc9901
January 6, 2020

Hi Arun,
I tried with above coral3-select but it didn't worked ,getting same issue (value as undefined).

Iam having one more issue in JS in show/hide tab .
EX:can you please find below spinet,
function events() {
var select = $('.coral-Form-fieldwrapper #banner_select coral-select-item[selected]').val();

here i can able to get "select" value
if (select != undefined) {
if (select == "homebanner") {
$('a[aria-controls="homebannerid"]').show();
$('a[aria-controls="productbannerid"]').hide();
$('a[aria-controls="blogbannerid"]').hide();
$('a[aria-controls="resourcebannerid"]').hide();
$('a[aria-controls="prefooterbannerid"]').hide();
$('a[aria-controls="historybannerid"]').hide();
}
in this "aria-controls" is not working .
Is there any alternative for this to use?

Thanks,

Guru.

guruprasadc9901
January 6, 2020

1. you can write an event of for dropdown like below e.g. 

 

$(document).on("selected", ".cq-dialog-dropdown-showhide-multi", function(e) {
        showHideHandler($(this));
    });

better to add an id or class to dropdown to get item easily 

2. just use id without a tag

e.g.
$('#homebannerid').show();
$('#productbannerid').hide();

but you may need to take care of hidding tab list as well.


Hi Arun,

1)This is how i had written an event,here modeType is an variable, contains an string.
modeType.on('selected.select', function(event) {
showHideSection($(this));
});
}

I tried what you have given as example ,but both the cases value is getting as undefined.

2)I tried giving id's  without tags,but i didn't get any show/hide functionality .

thanks,
guru.