LOSTBOY Posted January 27, 2009 Share Posted January 27, 2009 I have a text field and a submit button.The top one has a function connected to the onblur event when someone leaves the text field.The submit button has a funciton connected to the onclick event. when I move the mouse from the text field to the button and press the button.the text input loses focus, which fires its blur event and it wont fires its click event. here i give an example:Please check out this <html> <header> <script type="text/javascript" src="../javascript/ui/jquery.js"></script> <script type="text/javascript"> $(function(){ $("#a").blur(function(){ hi1(); }); $("#Submits").click(function() { hi2(); }); }); var id = ""; function hi1(){ id = "1"; alert(id); return; } function hi2(){ id = "2"; alert(id); } </script> </header <body> <form name="frm" method="post"> <input type="text" id="a" name="a" > <input type="button" id="Submits" name="Submits" value="click me" > </form> </body> </html> and give me the suggestion to overcome this problem. ??? :'( Quote Link to comment https://forums.phpfreaks.com/topic/142603-problem-with-onblur-and-onclick-event/ Share on other sites More sharing options...
bobleny Posted January 27, 2009 Share Posted January 27, 2009 I have no clue what is going on there, but this does what you described. I just hope you can outfit it with your code... <html> <head> <script type="text/javascript" src="../javascript/ui/jquery.js"></script> <script type="text/javascript"> <!-- function Blury(feild) { alert(feild.value); } function Submits() { alert("Submits!"); } //--> </script> </head> <body> <input type="text" name="a" onblur="Blury(this)" /> <input type="button" name="Submits" value="click me" onclick="Submits()" /> </body> </html> If this doesn't help you, I will be glued to this topic to see what the deal is with your code........... :-\ Quote Link to comment https://forums.phpfreaks.com/topic/142603-problem-with-onblur-and-onclick-event/#findComment-747847 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.