javascript - Jquery a href onclick to controller without reload page -


i trying write code includes confirm message using jquery.

İf ı click exit according below code occurs reload of page.

<a href="exit" onclick="return confirm('are sure want exit?')">exit</a> 

how can ı write above code without reload page confirm message in jquery ?

İf confirm ok = go href (without reload) İf confirm cancel = cancel it,

try following code

<a href="#exit" onclick="return confirm('are sure want exit?'); return false">exit</a> 

explanation:

# url fragment name preceded hash mark (#), specifies internal target location (an id) within current document.

while return false way tell event not fire.

see demo


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

mysql - Pass value between different pages (form) with PHP -