I am new to jQuery development and the code below just will not work
in IE6.
(a) The new checkboxes will not check
(b) The function is able to update the 'id' values but not the 'name'
for the new input fields being created.

Mozilla works fine with all this. What am I doing wrong? Any help will
be greatly appreciated.

<html>
  <head>
    <script type="text/javascript" src="jquery.js"></script>

    <script type="text/javascript">
                $("document").ready(function(){
                        $("input[id^='button-']").bind("click", copyOnClick);
                });

                function copyOnClick(){
                        var idSplit = this.id.split("-");
                        var newSequenceNumber = parseInt(idSplit[1]) + 1;

                        var closestTableRow = $(this).parent().parent().get(0);
                        var newRow = $(closestTableRow).clone(true);

                        newRow.find("input[id^='button-']").attr("id", 
"button-" +
newSequenceNumber);

                        newRow.find("input[id^='text-']").attr("id", "text-" +
newSequenceNumber);
                        newRow.find("input[id^='text-']").attr("name", "text-" +
newSequenceNumber);
                        newRow.find("input[id^='text-']").attr("value", 
"dummy");

                        newRow.find("input[id^='check-']").attr("id", "check-" +
newSequenceNumber);
                        newRow.find("input[id^='check-']").attr("name", 
"check-" +
newSequenceNumber);
                        newRow.find("input[id^='check-']").attr("value", 
"cBox");
                        newRow.find("input[id^='check-']").attr("checked", 
"checked");

                        //Add listener to the new add button
                        newRow.find("input[id^='button-']").bind("click", 
copyOnClick);

                        //Insert new row
                        $(newRow).insertAfter($(closestTableRow));
                }
    </script>
  </head>
  <body>
        <form id="myForm" name="myForm">
                <table>
                        <tr>
                                <td><input id="button-0" type="button" 
value="Add" /></td>
                                <td><input id="text-0" name="text-0" 
type="text" value="" /></td>
                                <td><input id="check-0" name="check-0" 
type="checkbox"
value="cBox" /></td>
                        </tr>
                </table>
    </form>
  </body>
</html>

--

You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en.


Reply via email to