JQuery - $("xx").remove(); Not working w new JQuer

JQuery - $("xx").remove(); Not working w new JQuer

Hello,

Im having a bit of difficulty with a form. Basically i used a script to add and remove text input elements which can be found here: Mohdshaiful Add/Remove Elements

Now this script relied on an old Jquery pack (mid 2007 release) This pack can be found here: Old JQuery

The use of JQuery is for this:


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Test jQuery</title>

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

<script type="text/javascript">
function addFormField() {
   var id = document.getElementById("id").value;
   $("#divTxt").append("<p id='row" + id + "'><label for='txt" + id + "'>Field " + id + "&nbsp;&nbsp;<input type='text' size='20' name='txt[]' id='txt" + id + "'>&nbsp;&nbsp<a href='#' onClick='removeFormField(\"#row" + id + "\"); return false;'>Remove</a><p>");
   
   
   $('#row' + id).highlightFade({
      speed:1000
   });
   
   id = (id - 1) + 2;
   document.getElementById("id").value = id;
}

function removeFormField(id) {
   $(id).remove();
}
</script>

<body>

<p><a href="#" onClick="addFormField(); return false;">Add</a></p>
<form action="#" method="get" id="form1">
<input type="hidden" id="id" value="1">
<div id="divTxt"></div>
<p><input type="submit" value="Submit" name="submit">
<input type="reset" value="Reset" name="reset"></p>
</form>

</body>
</html>


Using the Jquery file above makes the code function as i need it to, However i have recently had to use the latest JQuery pack for another element on my form to function correctly. And since using the latest version the element above has stopped working. The element can be added okay, however it cannot be removed. I have done some simple trouble shooting and found the cause to be the new JQuery pack.

Im obviously not a professional in this area but usually i can get my head round things like this, i just havent been able to get the "ahhh thats why" moment.

Ill be eternally grateful if anyone has any solutions to this, im out of the loop regarding JQuery updates so i thought it would be best consulting you guys.

Again thank you very much in advance