Jump to content

Problem With onBlur and onClick Event


LOSTBOY

Recommended Posts

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. ??? :'(

Link to comment
https://forums.phpfreaks.com/topic/142603-problem-with-onblur-and-onclick-event/
Share on other sites

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........... :-\

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.