javascript - prevent laravel link_to_action to perform on double click -
in laravel project controller wrote code approve , reject appointments. on rejecting appointment entry deleted database , redirect again listing table.
i used code in reject section
html_entity_decode(link_to_action('admincontroller@getatoggle', '<img src="'.$icon2.'"alt=asknow width=20 height=20/>',array($data['appointment_id'],2),array('title'=>'click me reject','ondblclick' => "event.preventdefault();")));
but still when double clicks " trying property of non-object "
error showing. know occurs because , on first click entry deleted database second click there no entry delete in db. in case user double clicks don't want show them error message or 404 page.
so there way prevent double clicks. tried "alert"
in "ondblclick"
shows both alert , error page.
i think problem you're trying use event
before it's been initialised.
try move code <a>
tag js files, try jquery
$( "#target" ).dblclick(function(event) { event.preventdefault(); });
i'm passing in event
callback can run preventdefault()
.
Comments
Post a Comment