In my application I am using a simple JavaScript popup and successfully invoking it this way-
<a href="javascript:popup('Hello World')>Click Me</a>
I was wondering whether it is possible to invoke the same popup on other jQuery events. For instance
$("#some_button_id").click( function() {
javascript:popup('Hello World');
});
The above method doesn’t work. Any other solution?
EDIT – You don’t need the
javascript:part because you are not attaching javascript inline.But that is not the cause of the error so make sure that you wait until the DOM is ready before attaching an event handler.
and of course make sure you define
popup()somewhere