I think you should probably unbind that inline onclick attribute on page ready and re-assign your own onclick function with jQuery (even if it's the same thing). Save your custom onclick callback function to a variable (as in, separate it from the onclick assignment so it's a standalone function that can be called elsewhere). Then use unbind() to unbind the click. http://docs.jquery.com/Events/unbind#typefn Then when you're ready, re-bind the click with the saved callback function again.
On Mar 26, 5:46 am, Adam Walters <ajwalt...@gmail.com> wrote: > Hello, > > I was wondering if there was a way to temporarily disable an inline > onclick event, which i can reattach later. Here's the scenario: > > My page has an edit mode which makes the text of certain elements > editable. > Edit mode is enabled -> text that is editable gets a click event bound > to it by jquery > Clicking the element allows you to inplace edit and save the info > Disabling edit mode removes the click event to activate an editable > element > > Everything works great unless there is an onclick attribute specifed > inline on the element (ie- rails generates an onclick confirm > message). So the inline confirm is raised first, then my subsequent > bound click events. > > Is there a means i can temporarily disable (or remove/reattach) these > inline javascript events? > > I'm using jQuery 1.3.1 > > Thanks in advance, > Adam Walters