Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

select2 clear options

Remove the selected options : 
-----------------------------
$('#mySelect2').val(null).trigger('change');

============================================

Completly remove the select2 initialization :
--------------------------------------------
$('#payment_method').html('').select2({data: [{id: '', text: ''}]});
Comment

jquery clear select 2

$('select2element').val(null).trigger("change")
Comment

jquery reset select2

$("#customers_select").val('').trigger('change')
Comment

select2 clear selected

$("#mySelect2").select2({
    allowClear: true
});
Comment

reset select option jquery

$('ClassOrIDName').prop('selectedIndex',0); 
// this works perfectly. just put this in any action and your 1st option should be 'select one item' type
Comment

reset select2 jquery | clear select2 option value

$("ClassOrIDName").trigger("change");
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to assert in javascript 
Javascript :: convert json to array 
Javascript :: checking scroll position with js 
Javascript :: js how to convert vh to pixel 
Javascript :: javascript parsestring 
Javascript :: javascript between 
Javascript :: discord.js clear console 
Javascript :: javascriot function 
Javascript :: vue axios post return json data 
Javascript :: lodash compare array without order 
Javascript :: nodejs add new property array object 
Javascript :: looping through local storage javascript 
Javascript :: Convertir Map a Json 
Javascript :: pattern alphabet and space 
Javascript :: how to use cookies in react js 
Javascript :: javascript download html to pdf 
Javascript :: at leastone checkbox required jquery 
Javascript :: nodejs end process 
Javascript :: cordova delete cache 
Javascript :: convert curl response to json format and echo the data 
Javascript :: javascript get distance between months 
Javascript :: logic operators in javascript 
Javascript :: uppercase-the-first-letter-of-a-string-using-javascript/ 
Javascript :: remove eslint check react native 
Javascript :: serializeobject jquery 
Javascript :: next js styled components classname did not match 
Javascript :: reverse a string while keeping spaces in javascript 
Javascript :: online python to c converter 
Javascript :: how to toggle navbar using javascript 
Javascript :: joi allow additional properties 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =