Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
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
Level 8
3 Replies

Avatar

Correct answer by
Level 8

Avatar

Level 8

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