run function when click a button

Go To


i add this script to my page it is a poll contain a button i want when user click on button it run a function

JavaScript embed code:

   <script type="text/javascript" charset="utf-8" src=""></script>
   <noscript><a href="">أختار مرشحك للرئاسة</a></noscript>
2012-04-03 20:05
by Amr Salah Shalaby
Can you try to make your question more understandable? There's no real sentence here - simchona 2012-04-03 20:06


Use jquery like this:

$('.pds-vote-button').bind('click', function() {
  //call your function

you may want to unbind what is already happening....

2012-04-03 20:13
by Steen
not work ..... - Amr Salah Shalaby 2012-04-03 20:26
Sorry, my bad, its a class...will update the answer. Meanwhile check this fiddle - Steen 2012-04-03 20:35
still not work , i am completely new in coding this is my function - Amr Salah Shalaby 2012-04-03 21:08
i fix it thx alotttttttttttttt - Amr Salah Shalaby 2012-04-03 23:22


Just substitute your function name

<a href="" onclick="functioneName()">
2012-04-03 20:07
by RyanS
inline javascript is a bad idea - zzzzBov 2012-04-03 20:07
@zzzzBov: care to expand upon "bad idea", or provide a link - bernie 2012-04-03 20:08
and this link is in a noscript-tag.. - NoName 2012-04-03 20:08
@RyanS, HTML, CSS, and JS are MVC. Each belong in their own file - zzzzBov 2012-04-03 20:31