How do I bind the Overlay Tool for new Ajax elements in Jquery?
- by Hooman Ahmadi
Hi,
I'm using:
echo $javascript->link('tools.overlay-1.0.4', false);
which is initialized with:
$(".overlay_popup").overlay({
expose: '#000000',
close: '.close_overlay',
finish: {
top: 'center',
left: 'center',
absolute: false
}
});
I call the overlay popup box like this:
echo $html->link(
"add part",
array('controller'=>'garage_parts',
'action'=>'addfrompartlist',
$gcar['GarageCar']['id'],
$gcar['GarageCar']['car_id']),
array('class'=>'js-ajax overlay_popup',
'id'=>'add_part_overlay',
'rel'=>'.overlay_container')
);
This all works fine and dandy, however I have an ajax function that dynamically adds the "add part" hyperlink button shown above and I have no idea how to bind this new button to the overlay. Normally, I would use something like this:
$(".overlay_popup").bind("click", function(){... but this didn't work for the overlay. Any ideas on how I can successfully do this?