Skip to content Skip to sidebar Skip to footer

Jquery In Javascript Function Require Two Clicks

I wrote a simpe inline edit using jquery. The plugin work very well, but i have a problem when i call the script within a javascript function, it require 2 click to activate the pl

Solution 1:

If the functionality in the plugin requires the click event handler that you're setting up inside, then that means it won't be set up until you run .kb_edit().

So the first click runs .kb_edit(), which sets up the click handler.

Then the second click actually gets to trigger whatever was set up by the first click.


Solution 2:

well for starters you could clean it up a little by NOT using the onclick...

<a id="myAnchor">Let's update</a>

$(document).ready(function() {
   $("#myAnchor").click(function(){
        ///put your update code here including the kb_edit code
   });
});

or if you have a series of this you can use <a class="myAnchor">...</a> and change the jquery selector:

   $(".myAnchor").click(function(){

Post a Comment for "Jquery In Javascript Function Require Two Clicks"