Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

select2 find option by text

$("#select").select2("val", $("#select option:contains('Text')").val() );
Comment

select2 find option by text

let long_name = 'Australia';
let $element = $('.country-js')
let val = $element.find("option:contains('"+long_name+"')").val()
$element.val(val).trigger('change.select2');
Comment

PREVIOUS NEXT
Code Example
Javascript :: reg ex with filter in js 
Javascript :: javascript filter array of objects by array 
Javascript :: javascript mouse over and mouse enter 
Javascript :: array.from js 
Javascript :: select a particular sibling jquey 
Javascript :: javascript current target 
Javascript :: dropzone csrf codeigniter 
Javascript :: javascript multiline script 
Javascript :: convert a string into an integer 
Javascript :: check array values equal js 
Javascript :: reverse javascript 
Javascript :: useref reactjs 
Javascript :: javascript ternary operator 
Javascript :: round innerhtml up javascript 
Javascript :: vue 3 route params 
Javascript :: html to react converter 
Javascript :: leaflet change marker location 
Javascript :: filter through date in mongooes 
Javascript :: array cut only last 5 element 
Javascript :: import js file 
Javascript :: mongoose search by name 
Javascript :: react native picker 
Javascript :: sequelize array of strings 
Javascript :: js addeventlistener foreach 
Javascript :: data-dismiss="modal" in js 
Javascript :: object key as variable 
Javascript :: reverse the string in javascript 
Javascript :: react native password 
Javascript :: sequelize update sql 
Javascript :: hourglasses js 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =