run function when click a button

Go To StackoverFlow.com

-4

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="http://static.polldaddy.com/p/6061322.js"></script>
   <noscript><a href="http://polldaddy.com/poll/6061322/">أختار مرشحك للرئاسة</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


0

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 http://jsfiddle.net/B7Xwf - Steen 2012-04-03 20:35
still not work , i am completely new in coding this is my function http://jsfiddle.net/bT25A/3 - Amr Salah Shalaby 2012-04-03 21:08
i fix it thx alotttttttttttttt - Amr Salah Shalaby 2012-04-03 23:22


0

Just substitute your function name

<a href="http://polldaddy.com/poll/6061322/" 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
Ads