Here is how I did it
//wrap a div arround the table
$(this).wrap('<div class="table_space"><div class="table_wrapper_div">
</div></div>').parent().before('<button class="my_button" >
EXPANDIR</button>').after('<button class="my_button">EXPANDIR</button>');
this = a very big table
$('.my_button').toggle(
function(){
... blablabla ...
},
function(){
... blabllaba ...
}
);
But the toggle event is never triggered… now if I add the button directly in the html page then the toggle event is in this case triggered.
Any help will be great, I’ve looked for other questions but didn’t find any clue.
Thanks a lot
EDIT: NB – the wrapping gives exactly what I need and puts the buttons between table_space and table_wrapper_div
You need to delegate in such cases where the elements are dynamically added to your HTML …
Internally the event is associated using a click event..
Try this approach