Have a script to add / remove options from a select field — the “value” of the option I want to remove should be equal to the “class” of the link clicked. I’ve tried several different versions of this script and I cannot for the life of me figure out how to properly get the variable delText into the function to remove it. help pls!
$('a.del').click(function() {
var delText = $(this).attr('class');
window.parent.$("select[name='<?php echo $f; ?>']").remove($("<option></option>").text(delText));
});
If the
valueof the element is equal to theclassof the link, then do this:I’m not sure if that actually jives with what you’re trying to do? The
<?php ?>bit seems really out of place, and the I’m not sure about thewindow.parentbit either.