Can I select three IDs with a shorter jQuery script? -


i believe there better way selecting these 3 ids dropdown-list (id 115, 116 , 117):

jquery(document).ready(function($) {     var usednames = {};     $("select[name='item_meta[115]'] > option").each(function () {         if(usednames[this.text]) {             $(this).remove();         } else {             usednames[this.text] = this.value;         }     });      var usednames = {};     $("select[name='item_meta[116]'] > option").each(function () {         if(usednames[this.text]) {             $(this).remove();         } else {             usednames[this.text] = this.value;         }     });      var usednames = {};     $("select[name='item_meta[117]'] > option").each(function () {         if(usednames[this.text]) {             $(this).remove();         } else {             usednames[this.text] = this.value;         }     }); }); 

can make code shorter, , have ids selected under first variable?

you can use attribute starts selector

$("select[name^='item_meta'] > option") 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -