0

I've managed to cut and paste together the following script:

http://jsfiddle.net/tbfHF/13/

It basically takes the value of the input box and inserts into another generated element along with a link that should delete the item when clicked. Now I need to each field and X to be surrounded by a div so that the output would be like below

<div class="regItm">
  <input properties.../><a properties...>X</a>
</div>
<div class="regItm">
  <input properties.../><a properties...>X</a>
</div>
...
...
4

1 回答 1

0

You can use wrapAll() to wrap all elements in selector with

$('input:last,a:last','#basket').wrapAll('<div class="regItm"></div>');

Get the last input and last anchor in your basket and wrap both with the div. So you can add that code right after you append the elements to your basket.

http://jsfiddle.net/KYkJn/

于 2012-10-23T21:57:37.383 回答