Reputation: 510
i have found lots of example to create a button without postback. However, all fail in my case, so can you check it?
<asp:Button ID="btnNew" CssClass="btnNew btn" runat="server" Text="New" OnClientClick="showDiv(); return false;" />
<button id="btnNew" class="btnNew " onclick="showDiv();">New</button>
//jQuery function => $("#btn").Click();
For this button, i won't use it in server, so it should be a pure html button..
Can anyone tell me what's wrong of above code?
Upvotes: 0
Views: 189
Reputation: 86
Letting the function "showDiv" return "false" should do the trick.
function showDiv() {
[your code]
return false;
}
Upvotes: 0
Reputation: 14604
If you don't want to call server
side function simply add input type='button'
<button type="button" id="btnNew" class="btnNew" onclick="showDiv();">New</button>
OR
<input type="button" id="btnNew" class="btnNew " value="New" onclick="showDiv();" />
Upvotes: 1