Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

select2 get selected value

//get all selected select object
$('#select2Id').find(':selected');

//get all selected value 
$("#select2Id").select2("val");
Comment

jquery select2 set value

<select id="lang" >
   <option value="1">php</option>
   <option value="2">asp</option>
   <option value="3">java</option>
</select>

<script>
	$("#lang").select2().select2('val','1');
</script>
Comment

Select options of Select2 control based on values using Jquery

$('#mySelect2').val('1'); // Select the option with a value of '1'
$('#mySelect2').trigger('change'); // Notify any JS components that the value changed
Comment

get select2 selected value jquery

$('#id :selected').text();
Comment

Select options of Select2 control based on values using Jquery

$('#mySelect2').val(['1', '2']);
$('#mySelect2').trigger('change'); // Notify any JS components that the value changed
Comment

select2 set value jquery

$('#inputID').select2('data', {id: 100, a_key: 'Lorem Ipsum'});
Comment

select2 set value jquery

$('#all_contacts').select2('data', {id: '123', text: 'res_data.primary_email'});
Comment

PREVIOUS NEXT
Code Example
Javascript :: mongoose findoneandupdate 
Javascript :: convert moment info to dd mmm yyyy 
Javascript :: js element text color 
Javascript :: Remove duplicate items form array using reduce() method. 
Javascript :: javascript password generator 
Javascript :: add class when element in viewport vanilla javascript 
Javascript :: how to print in jsp 
Javascript :: placeholder value js 
Javascript :: js generate random color 
Javascript :: append object to object javascript 
Javascript :: regex one or more words 
Javascript :: json with multiple objects 
Javascript :: discord.js guildMemberAdd 
Javascript :: js paste 
Javascript :: is material ui not working with react 18 
Javascript :: input in javascript 
Javascript :: fetching foreign key data in sequelize 
Javascript :: replace element from string javascript 
Javascript :: js remove property from object 
Javascript :: agregar clase en jquery 
Javascript :: datetime knex 
Javascript :: jquery focus 
Javascript :: sort array of objects by string property value 
Javascript :: column.footer jquery 
Javascript :: js input type range get value while sliding 
Javascript :: javascript get now date yyyy-mm-dd 
Javascript :: express-ejs-layouts install 
Javascript :: jquery loop through collection backwards 
Javascript :: js get random hex color 
Javascript :: javascript extract number from string 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =