-4

I'm using .each iterating through all the options of the select tag and checking the condition If(this.selected)

This doesn't work for to get it done.

1 Answers1

1
$("#select-id option").each(function() {
  if($(this).attr('selected')) {
    //your code for selected
  }
});
Iftikhar Ali Ansari
  • 1,650
  • 1
  • 17
  • 27