views:

46

answers:

1

Hi! I want to make sure that the structur of my form is like that:

<form>
    <div>
      <label>
      <input>
    </div>
<form>

I use jquery to catch the label from whereever it is and move it between <div> and <input>. This works fine in Firefox but IE has problems with that. How can I get it running with IE?

Here's the line that causes errors in IE6 and IE7:

var inputname = $(this).attr('name');
$(this).parents('form').find('label[for='+inputname+']')
       .prependTo($(this).parent('div.slidebeyond-div'));

Thank you!

+1  A: 

Question: how are you verifying that the element is not being moved?

When you run the code in FF, the label element gets moved to directly below the div You can verify this with Firebug.

When you run the code in IE the label also gets moved to the right spot. If you use view source to inspect the DOM you are only seeing the DOM before all of your jQuery did its thing.

Edit I am also assuming that the code you have supplied is within a:

$('input').each(function(){});

clownbaby
right...sorry seems that even my debugging is buggy ;-)
Marcel