I’m having trouble firing a click event on an .
When insertIntoInsertHolder() is called it adds a link to the content of div#swf_insert_holder – I then create the click event just below. However the event doesn’t fire.
$javascript = "javascript:;";
$swf_insert_box_link = "swf_insert_box_link";
echo "
function insertIntoInsertHolder( filename ) {
$('#swf_insert_holder').append('<a href=" . $javascript . " class=" . $swf_insert_box_link . ">go</a>');
//produces: <a href="javascript:;" class="swf_insert_box_link">go</a>
}
$('a.swf_insert_box_link').click( function() {
alert('hello!!'); //for testing
});
Thanks in advance!
Using this will cause it to work:
The important parts were #1, fixing all PHP syntax errors and #2, using
liveinstead of click so you can define the event callback before the element actually exists.