javascript - Select2 dropdown doesn't close on click -


i'm using select2 (v4) in multiple select form , having difficulty getting dropdown close functionality need. have closeonselect set false, user can add multiple values easily. i'm seeing on test site on browsers except ios, when click outside of dropdown area, dropdown closes (which desired behavior). on ios, way close click inside input.

oddly enough, in trying replicate via jsfiddle, can version 4 of select2 behave way i'm seeing on ios - http://jsfiddle.net/8g27t277/

i have jsfiddle using select2 v3.4.6 shows click-to-close functionality want across browsers - http://jsfiddle.net/0tefq3yz/

test html:

<select id="options" size="9">     <option value="357">one</option>     <option value="358">two</option>     <option value="359">three</option>     <option value="360">four</option>     <option value="361">five</option> </select> 

test js:

$('#options').select2({     "placeholder": "pick multiple options",     "multiple": true,     "closeonselect": false }); 

what's causing dropdown close (or not) in response click events outside input?

i have same problem, after while found out clicking on html page won't job. select 2 dropdown close work alone inside body tag. if have entire page spanned (entire page covered in body tag), clicking close dropdown.

here updated jsfiddle

***html*** <body class='bodyclass'>   <div class='mainclass'> <select id="options" size="9">   <option value="357">one</option>   <option value="358">two</option>   <option value="359">three</option>   <option value="360">four</option>   <option value="361">five</option> </select> 

***css*** select { width: 300px; } .bodyclass{   width:100%;   height:500px; }  ***js***  $('#options').select2({ "placeholder": "pick multiple options",     "multiple": true }); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -