You can select on any attribute and its value by using the attribute selector [attributename=optionalvalue], so in your case you can select the option and set the selected attribute. 5 jQuery Fade-In and Fade-Out. $("div.id_100 > select > option[value=" + value + "]").prop("selected",true); Where value is the value you wish to select by. However, you may also define your configuration options by using the HTML5 data-* attributes, which will override any options set when initializing Select2 and any defaults. If I were to submit this form now, the value submitted through POST would be select/select2 instead of … Default: null. Change no result found text Set new value using no_results_text option. Add the data-mini="true" to get the mini/compact sized version for all the buttons that appear in the controlgroup.. Checkbox. It should be noted that jQuery's data() doesn't change the data attribute in HTML. Topic: JavaScript / jQuery Prev|Next. Elements with the selected attribute, but with a … The option that is having the selected attribute will be displayed by default. Here we have set jQuery click() method on the button with id “selectOption”. ... i WONDER HOW DO I GET DATA FROM DYNAMICALLY FROM A EXTERNAL HTML FILE AND LOAD IT TO A SELECT MENU? Since version 1.4.3, jQuery’s data() method has parsed HTML5 data attributes. data exclusive. ... Prev jQuery : Select option Tag Common Operations. Note: data-role="fieldcontain" is deprecated as of jQuery Mobile 1.4.0 and will be removed in 1.5.0. Syntax: