I have a series of type combos <select>
where three values have to be displayed and they are being displayed well. The functionality that I need is that when receiving the focus, that is to say that it is clicked or that by tabulating it is reached and displayed, one of the values is eliminated but only for that combo, specifically the one that has an empty valueoption[value='']
I'm trying to do it by creating a class called .eliminarblanco
that all the combos have but I can't select the specific element that clicks within the function, the one that arrives by the event, so that I can eliminate it
$(".eliminarblanco").on('focus', function (event) {
//Aqui es donde no veo como hacer para que en pseudocodigo fuese algo como $((this).option[value='']").remove();
});
Thank you very much
You could use the function
.find()
to find the option to remove and then remove it, something like this:Example
An easy way to do this is with hiding with
hide
the option based on its value. To make itselect
the one you doclick
, you pick up the oneid
at the eventclick
and manage the options for that oneid
. Example: