Programmatically calling a submit button

Hi Guys,


Wondering if anyone knows away of calling the submit button on a search page programmatically rather than using keyword %submit_button%? Is this possible?



I would like run javascript on the submit button onclick but haven’t found a way of calling them without using the keyword.



Cheers,

SCF

Not sure what you are asking here. You are saying you DO want to add an onclick event?

[quote]
Not sure what you are asking here. You are saying you DO want to add an onclick event?

[/quote]



Thanks for the reply Nic. It was rather long day on Friday :slight_smile:



Yeah I would like to add an onclick event to a submit button on my search asset page. Only way I know how to call the submit button currently is using the keyword %submit_button%.



So instead of '%submit_button%' I want to use '<input type="submit" value="Submit" />'. Then I'm free to add my onclick event to it.

[quote]
Thanks for the reply Nic. It was rather long day on Friday :slight_smile:



Yeah I would like to add an onclick event to a submit button on my search asset page. Only way I know how to call the submit button currently is using the keyword %submit_button%.



So instead of '%submit_button%' I want to use '<input type="submit" value="Submit" />'. Then I'm free to add my onclick event to it.

[/quote]



You should't need to modify the keyword, rather you should bind the onclick event, which is better than an inline onclick. Here is a jQuery example:


    $(function() {
    	$('#submit').click(function() {
    		// Do something when clicked							
    	});
    });


You will have to change the selector so that it matches your submit button.

[quote]
You should't need to modify the keyword, rather you should bind the onclick event, which is better than an inline onclick. Here is a jQuery example:


    $(function() {
    	$('#submit').click(function() {
    		// Do something when clicked							
    	});
    });


You will have to change the selector so that it matches your submit button.
[/quote]

Thanks so much Nic, I'll give that a go.