Saturday, 15 September 2012

javascript - YES/NO before firing Link -



javascript - YES/NO before firing Link -

i need yes/no prompt before link fired. i've tried several solutions found on none worked out fine. none did block firing of link, except confirm(). confirm() not give me chance alter stuff or alter button labels. want add together value url depending on user chose. problem have list of these links on page (events). help appreciated.

edit 1

$("a").click(function(e) { e.preventdefault(); });

is not working , in case don't know how access url. , want postpone calling of url.

edit 2 code creation of link (cakephp):

echo $this->html->link( $this->html->image('image.png',array( 'title' => __('title'), 'alt' => __('title') )), array( 'action' => 'action', $eventid, $anothervar, $this->paginator->current(), $customerid ), array('escape' => false) );

now want inquire client yes/no question , depending on client take add together parameter url.

edit 3 html code created thru code above:

<a href="/system/controller/function/value1/value2">

<a href="home/about-me" onclick="return confirm('are sure move page');">click me</a>

the simplest thing ever developer.

here reference custom confirm box,

custom confirm box

else if want alter whole box , functionality, go jquery modal box,

jquery modal

javascript jquery cakephp

No comments:

Post a Comment