Do it the jQuery way (and fix the errors):
$('#stop').click(function() {
$('#next').click(stopMoving);
// ^-- missing #
}); // <-- missing );
If the element already has a click
handler attached via the onclick
attribute, you have to remove it:
$('#next').attr('onclick', '');
Update: As @Drackir pointed out, you might also have to call $('#next').unbind('click');
in order to remove other click handlers attached via jQuery.
But this is guessing here. As always: More information => better answers.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…