Expand my Community achievements bar.

Unable to read value in Drop down in Firefox

Avatar

Level 9

Hi All,

I have Dropdown widget of  type "granite/ui/components/coral/foundation/form/select" which has 3 values(None,Standard,Featured).Based on the selection of a value in this dropdown I need to hide/show other widgets.In Chrome browser,i am able to get the selected value where as in Firefox always i am getting blank unable to fetch th selected value.

Below is the code snippet which I am using to achieve this.

$(document).on("foundation-contentloaded", function () {              

       var selectedPromoTypeOption = $('.promo-type-selection coral-select-item[selected]').val();

       alert("selectedPromoTypeOption::"+selectedPromoTypeOption);

       if (selectedPromoTypeOption == "none" || selectedPromoTypeOption == "standard") {

           $('.article-color-options').closest('.coral-Form-fieldwrapper').addClass('hide');

       }

})

Anyone has any idea ,how to fetch the selected irrespective of the browser.

Thanks,

GK   

2 Replies

Avatar

Level 10

I talked to our team about this. The reply was:

Hey here is a sample

https://experience-aem.blogspot.com/2019/02/aem-6420-adding-composite-multifield-items-based-on-cora...

1. get the select

var $countSelect = $("coral-select[name='" + COUNT_SELECT + "']");

2. get the value

var maxCount = parseInt(countSelect.value),

Avatar

Level 9

I have followed the article and tried to get the value as mentioned in the article but not able to read value.

In Firefox browser, when evaluating this expression it's always returning emprty value.

Is there any other way to read the value ir-respective of browser?

var selectedPromoTypeOption = $('.promo-type-selection coral-select-item[selected]').val();