javascript - Remove option from select where text started with 'aa' -


i have select options:

<select id="sel">     <option value="1">aadkdo</option>         <option value="2">sdsdf</option>     <option value="3">aasdfsddkdo</option>     <option value="4">aadkfsdfdo</option>     <option value="5">sdfs</option>     <option value="6">aafsdfdkdo</option>     <option value="7">sdfsdf</option> </select> 

how can remove select option text started aa. example thera 1, 3, 4 , 6.

$('#sel option').each(function(){     if(???){        $(this).remove();        } }) 

fiddle: http://jsfiddle.net/azxew/

try this;

jsfiddle

$(document).ready(function() {     $('#sel option').each(function(){         if ($(this).html().substring(0, 2) == 'aa'){            $(this).remove();            }     }) }); 

Comments

Popular posts from this blog

php - cannot display multiple markers in google maps v3 from traceroute result -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -