I have a problem with element selection, i have a form and i want to run each function for each form select box, here is my code:
$("#profile_form select").each(function(i){
var seen = {};
$(this + 'option').each(function() {
var txt = $(this).text();
if (seen[txt])
$(this).remove();
else
seen[txt] = true;
});
});
Now my problem is with $(this + 'option') part, if i try to select only select menu it works fine, but i need to select option and if i do that i get:
Uncaught Error: Syntax error, unrecognized expression: [object HTMLSelectElement]option
what am i doing wrong?
Try this