Complete newbie working with jQuery and am having a bit of a problem.
I have a table with some of the cells having a in them (never more than one select per cell).
In the following code select is the element that was passed to the function. I’m trying to get the parent so that I can remove the and replace it with some html.
function submit_pick( select ) {
var parent = select.parent().get(0);
select.remove();
jQuery("#testdiv").html(parent.tagName);
parent.html(parent.tagName);
}
select.remove(); works as expected
jQuery("#testdiv").html(parent.tagName); also works as expected producing TD
parent.html(parent.tagName); does not work. Firefox’s web console gives an error parent.html is not a function.
.get(0)returns a nativeDOMElementand notjQueryobject anymore, thus you need to wrap theparentinside$()(also the reason whyhtml()is complained as not being a function, ashtml()belongs to jQuery object, notDOMElement):