im trying to insert an html string (a form) into a div (at spot XXX) when .changeQty is clicked. I can only use classes, not id's cause the div repeats many times on the page
<div class='inline'><span class='currentQty'>Quantity: blah<span class='changeQty'> (Change)</span></span>XXX</div> the string is: "<form class="newQty">stuff here</form>" the code i came up with so far is below. it doesnt work but firebug doesnt give errors either ... i dont think i can use .insertAfter(".changeQty") because then it will insert it after every instance of that class it finds on the page. so maybe i should replace it with $this? I'm also not sure if insertAfter is the best thing to use - should i use childElements? $(document).ready(function() { $(".changeQty").click ( function() { $("<form class='newQty'>stuff here</ form>").insertAfter(".changeQty"); } ) });