html - Issue in Chrome browser when select's option is removed with jQuery -
i have following html:
<select> <option value="0">remove me</option> <option value="1">test 1</option> <option value="2">test 2</option> <option value="3">test 3</option> <option value="4">test 4</option> <option value="5">test 5</option> </select> and want when user click on select, option value '0' removed. jquery script using:
$('select').on('click',function(){ $(this).find('option[value="0"]').remove(); }); this working in firefox , ie(10,9,8) in chrome, when option removed, last 1 duplicated this:

if click on select again, when expands, duplicated option gone. why not working in first place in firefox?
this fidle of issue - http://jsfiddle.net/fn5jl/1/
as workaround:
$('select').one('focus',function(){ $(this).find('option[value="0"]').remove(); }); i don't know strange behaviour comes from...
Comments
Post a Comment