Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

Manipulate coral select list options

Avatar

Level 2

Can we override  coral-selectlist-item selected attribute of dialog box in javascript? Can not remove selected atribute from coral select options list by javascript in aem 6.5

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
3 Replies

Avatar

Correct answer by
Community Advisor

Avatar

Community Advisor

Hi @Nusrat_Jahan ,

You can try to create your custom JS file which will overwrite the desired attribute.

Something like below, this is just a vague logic but you may need to modify it based on your requirement

(function (document, $) {
    "use strict";

    $(document).on("foundation-contentloaded", function () {
    setValue(dropDownSelector);
    });

    function setValue(dropDownSelector) {
    
        $(dropDownSelector).each(function() {
            $(dropDownSelector + " coral-selectlist-item[value="+ hrefLang +"]").prop('selected', false);
        });
    }

})(document, Granite.$);

 
-Tarun

Avatar

Administrator

@Nusrat_Jahan Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni