jqueryinternet-explorer-7

why does this jquery not run in ie7


I'm new to jQuery and have managed to cut and paste together the following script:

http://jsfiddle.net/tbfHF/4/

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 it does almost what I need it to except for in IE where it appears that the script does not run at all. Anyone who can help with fixing that? And also help with wrapping the two generated elements (the text field and the X link) in a div so that the generated structure would be

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

--> UPDATE EDIT I've removed the commas so now it works in IE as well but the wrapping of the divs still remains, anyone who can show how that is done?

here is the updated version http://jsfiddle.net/tbfHF/13/


Solution

  • IE7 does not allow trailing commas after the last item in an object definition (other browsers don't object). Remove the trailing comma in this:

    .attr({value: regNum,})
    

    and this:

    {id: regNum,})
    

    This fixed version runs in IE7: http://jsfiddle.net/tbfHF/11/