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.

arunpatidar
Community Advisor
Community Advisor
January 6, 2020

Hi,

try with either one of them based on coral or granite resoirce type you are using.

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

or

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

 

you can simple look for DOM structure and parse through, the DOM structure may be changed in 6.5

I can see the aria-controls in DOM but theses are ids not option values.

 

Could you please explain in more details what is your requirement?

 

Example DOM for Coral3 dropdown

 

dropdown1.PNG

Arun Patidar