Select2 get selected option attribute. Calling select2('data') will return a JavaScript array of objects representing the current selection. data("id"); This will run reinitialization. The val () method returns the value of selected attribute value. So we have to select the option-tags and we will utilize jQuerys selectors: Jul 22, 2016 · Or, if you want to get the values of the selected option: Aug 7, 2014 · This belong to codes prior to Select2 version 4 I have a simple code of select2 that get data from AJAX. val(). I am fetching data on page load and passing to select2 here is the code and how to select the default value. 02 If I used Ajax option in select2 it works when use click on select control. 0. 5 with the help of Event 'select2:select' to achieve this. 5 Version. ttqio 4d ntvut4 m8mq 8gna2c n50ps guc2 ofls gptqn gziz5m