I have a example html menu:
A
I would suggest to use the live function, instead of the .click, because the elements added on run-time will also be clickable.
$('.menu_button').live('click', function() { var id = $(this).attr('id'); if (id == "m1") { //do your stuff here } });