Sunday, 15 March 2015

jquery - Remove option from dropdownlist in loop -



jquery - Remove option from dropdownlist in loop -

i have 2 dropdown boxes id's: test1 , test2. want dynamically remove options them code below, not work.

when alter this:

$("#test" +i4 "option[value='1/21.00/1']").remove();

into:

$("#test1 option[value='1/21.00/1']").remove();

it work.

how can +i4 work?

<script type="text/javascript"> var i4 = 1; while (i4 <= 2) { $("#test" +i4 "option[value='1/21.00/1']").remove(); i4++; } </script

you're missing + , space in

$("#test" +i4 "option[value='1/21.00/1']").remove();

should be

$("#test" + i4 + " option[value='1/21.00/1']").remove();

jquery

No comments:

Post a Comment