Harry Forbess
Harry Forbess

Reputation: 2134

dynamically set the dropdown jquery

I am trying to do this.

        $("#slot_+num  option[value='8']").remove();

if I do this

      $("#slot_0 option[value='8']").remove();

It works, but if I try to set the selector dynamically with variable num it doesn't do anything.

Upvotes: 2

Views: 74

Answers (1)

COLD TOLD
COLD TOLD

Reputation: 13599

You need to concatenate the string, like this:

$("#slot_"+num+"  option[value='8']").remove();

Upvotes: 2

Related Questions