How can i remove selected attribute from a select2 with Jquery?
I've alredy tried $("#form_cardtreatment option[value='13']").attr('selected', '');
- the option with value = 13 is selected. Can anyone help me?
This is the called function:
function changetreatmentybycard() {
alert("{{ treatmentid }}");
$("#form_cardtreatment option[value='{{ treatmentid }}']").attr('selected', '');
}
The "alert" work and print 13, the value off treatment id in twig.