jQuery append and remove dynamic table row

You only can have one unique ID per page. Change those IDs to classes, and change the jQuery selectors as well. Also, move the .on() outside of the .click() function, as you only need to set it once. http://jsfiddle.net/samliew/3AJcj/2/ $(document).ready(function(){ $(“.addCF”).click(function(){ $(“#customFields”).append(‘<tr valign=”top”><th scope=”row”><label for=”customFieldName”>Custom Field</label></th><td><input type=”text” class=”code” id=”customFieldName” name=”customFieldName[]” value=”” placeholder=”Input Name” /> &nbsp; … Read more

getElementsByClassName() doesn’t work in old Internet Explorers like IE6, IE7, IE8

IE6, Netscape 6+, Firefox, and Opera 7+ copy the following script in your page: document.getElementsByClassName = function(cl) { var retnode = []; var elem = this.getElementsByTagName(‘*’); for (var i = 0; i < elem.length; i++) { if((‘ ‘ + elem[i].className + ‘ ‘).indexOf(‘ ‘ + cl + ‘ ‘) > -1) retnode.push(elem[i]); } return retnode; … Read more

What do querySelectorAll and getElementsBy* methods return?

Your getElementById code works since IDs have to be unique and thus the function always returns exactly one element (or null if none was found). However, the methods getElementsByClassName, getElementsByName, getElementsByTagName, and getElementsByTagNameNS return an iterable collection of elements. The method names provide the hint: getElement implies singular, whereas getElements implies plural. The method querySelector … Read more