Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two onClick actions one button

Does someone know a wizards trick to make it work ?

<input type="button" value="Dont show this again! " onClick="fbLikeDump();" onclick="WriteCookie();" />

PS: I am using it in a .js file.

like image 403
jon de goof Avatar asked May 11 '12 02:05

jon de goof


1 Answers

Additional attributes (in this case, the second onClick) will be ignored. So, instead of onclick calling both fbLikeDump(); and WriteCookie();, it will only call fbLikeDump();. To fix, simply define a single onclick attribute and call both functions within it:

<input type="button" value="Don't show this again! " onclick="fbLikeDump();WriteCookie();" />
like image 182
xdazz Avatar answered Sep 20 '22 20:09

xdazz