I have an click function that I want to trigger outside of the function with parameters.
<div id="menubar">
<a id="menu_file_open">File Open</a>
<a id="menu_file_save">Save File</a>
</div>
$("#menubar a").click(function(event){
var menu_item = $(this).attr('id');
var $context = $(this);
switch(menu_item){
case 'menu_file_open':
//Do menu file open dialog
break;
case 'menu_file_save': break;
}
});
$('#menubar a').trigger('click'); //not working (ID,context not defined);
How would I pass in the ID and the context of the div as it was actually clicked.
$('#menubar a').click()instead of.trigger