Hi,

I have the following source:

<input type="text" class="myclass" value="Hello" style="width: 200px" /
>

And I would like to transform it into:

<p>Hello</p>
<div style="display: none">
  <input type="text" class="myclass" value="Hello" style="width:
200px" />
</div>

I'm using the JavaScript:

jQuery(document).ready(function(){
  jQuery('.myclass').each(function(index, domElement)
  {
    jQuery(domElement).wrapAll('<div style="display: none"></
div>').prepend('<p>' + jQuery(domElement).val() + '</p>');
  }
});

However, this produces:

<div style="display: none">
  <p>Hello</p>
  <input type="text" class="myclass" value="Hello" style="width:
200px" />
</div>

How can I get a jQuery reference for the structure wrapAll(...)
creates so I can prepend to it?

Many thanks,
- Nick

Reply via email to