![]() |
Registering an element into the DOM
I'm using the html() modification function to create an <img> tag with a certain class name. The image appears fine, but I have a jQuery event $(".classname").click() that will not register on this new image I've created. It works on all images with that class name otherwise; just the images that I dynamically create using html() don't seem to get properly added to the DOM in a place where they are then recognized by other jQuery actions.
Is there a way to get this to work? Event code on image click is: Code:
$(".editbtn").click(function() {Code:
$("#tnbrdisp").html(textString + '<img id="edittrknbr" class="editbtn" src="images/edit.png" alt="edit number" title="edit number" />'); |
Try the following:
Code:
$(".editbtn").live('click', function() {Code:
$(".editbtn").die('click'); |
| All times are GMT +1. The time now is 09:44 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.