It is my understanding that a typical "select" dropdown works as follows according to HTML standard -- when an option is selected from a dropdown list, a "selected" tag is added to the select option element (like this: http://www.w3schools.com/tags/att_option_selected.asp)
However using the Select2 component, I noticed the option "name" is added as the "title" attribute with "name" as value -- the "select option" element (or multiple elements in the case of a mulitple select) is not updated with the "selected" tag.
I want to serialize the form to send the form POST data via an Ajax request but the selected value does not get serialized because it is not in a supported form input element with the "selected" tag. Can you tell me if there is a way to add the "selected" tag to "select option" element?
Hi Kartik,
Awesome widgets, thanks for sharing!!
I had a question about the Select2 widget --
It is my understanding that a typical "select" dropdown works as follows according to HTML standard -- when an option is selected from a dropdown list, a "selected" tag is added to the select option element (like this: http://www.w3schools.com/tags/att_option_selected.asp)
However using the Select2 component, I noticed the option "name" is added as the "title" attribute with "name" as value -- the "select option" element (or multiple elements in the case of a mulitple select) is not updated with the "selected" tag.
I want to serialize the form to send the form POST data via an Ajax request but the selected value does not get serialized because it is not in a supported form input element with the "selected" tag. Can you tell me if there is a way to add the "selected" tag to "select option" element?
Thanks!