What is the alternate way of avoiding Postback on click on button when calling javascript function instead of writing return false in onclientclick event?

 Posted by Rajesh_Kumar on 2/12/2014 | Category: JavaScript Interview questions | Views: 2386 | Points: 40
Answer:

Use OnSubmit Event of Form tag to avoid postback:

<form name="frm" onsubmit = "return js_function()">

<input type="submit" name="Submit" value="Get Alert"/>
</form>


Here,js_function() is my Javascript function,and write return false inside that Javascript function.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response