Asif Mehmood
Asif Mehmood

Reputation: 473

How to click the button automatically with some action

<input type="button" value="Continue" onclick="ChoosePaymentOption();" class="calculate2" id="submitButtonId"/>

i want to click this automatically and onClick it should also run the function (ChoosePaymentOption();). before this i have only the idea of this but it is not doing any action like not calling any function.

<script type="text/javascript">document.forms[0].submit();</script>

Upvotes: 0

Views: 46

Answers (1)

Ranjana
Ranjana

Reputation: 825

You can use jquery to trigger click event on button and call the function within that.

$('#submitButtonId').click(function(){
   ChoosePaymentOption();
});

You can trigger that click on any point using $('#submitButtonId').click();

Upvotes: 1

Related Questions