How to avoid page refreshing/postback in calling Javascript function?

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

Just write return false semicolon after Javascript function in Button OnClientClick event as:-

<asp:Button ID="btn_alert" runat="server" Text="Get Alert" OnClientClick="alert_msg(); return false;" />

function alert_msg()
alert('Rajesh Kumar');

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response