This worked for me:

<head>
<script src="jquery-1.2.6.js"></script>
<script>
$(function(){
$("#myEl").wrap("<span></span>").parents().each(function(){alert
(this.tagName)})
});
</script>
</head>
<body>
<div>
<b id="myEl">something</b>
</div>
</div>
</body>

On Jan 23, 1:24 pm, Nic Hubbard <nnhubb...@gmail.com> wrote:
> I ran into a strange problem which too me a while to figure out what
> was going on.  I used the .wrap() function to wrap an element with a
> span.  Then, later on in my script I wanted to find all of the parents
> (using .parents() or even p.arent()) of the element that I wrapped.
> Strangely, it would always only find the parent that was wrapped
> around it, and nothing higher than that, is this normal?

Reply via email to