I'm using append to add an image to a <p id="p10">
$('#p10').append("<img src='plus.png' id='clicker' />");
I want to reference the image I've added via the append with the toggle:
$('#clicker').toggle(function() {
// toggle code here
}, function() {
// toggle code here
});
I cannot access the image element via the id to use the toggle. If I comment out the toggle, the image shows up on the page. As soon as I add the toggle code, the image blinks for a second and then disappears.