JQuery attr('onclick') Problem?

Do it the jQuery way (and fix the errors): $('#stop'). Click(function() { $('#next'). Click(stopMoving); // ^-- missing # }); // better answers.

Not enough info to be sure, but the OP is probably better off with $('#next'). One('click', stopMoving) – mikerobi Apr 25 '11 at 18:26 You should use: $('#next'). Unbind('click'); Also, you have "onlick" instead of "onclick".

:) – Drackir Apr 25 '11 at 18:27 @mikerobi: I think you mean . One('click', stopMoving). Yeah, maybe.... we don't know.

– Felix Kling Apr 25 '11 at 18:28 @Drackir: Thanks. – Felix Kling Apr 25 '11 at 18:29 it couldn't solve my broblem I need the way to change "onclick" attribute via attr('element','value') – Shako Kakauridze Apr 25 '11 at 18:29.

Use the code as Felix posted. Using jQuery you should not think of changing the onclick attribute of an element, but of attaching a click event listener to the element, which is done via the jQuery click() method.

Felix Kling's way will work, (actually beat me to the punch), but I was also going to suggest to use $('#next').die(). Live('click', stopMoving); this might be a better way to do it if you run into problems and strange behaviors when the element is clicked multiple times.

The easyest way is to change .attr() function to a javascript function .setAttribute() $('#stop'). Click(function() { $('next')0. SetAttribute('onclick','stopMoving()'); }.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions