Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

not rendering alert when focus is out of text box

 
TahirAhmad Dar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64824
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Inspect line #6 carefully.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64824
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
More problems: Why are there script tags between the head and body? Why are including jQuery twice?
 
TahirAhmad Dar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
// Thanks The following code works fine on eclipse


<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
<title>Focus Events</title>
<script type="text/javascript" language="javascript"
src="jquery.min.js"></script>
<script type="text/javascript">
$(document).ready ( function(){
//Focus the component when document is ready
$("input#inputBoxId").focus();
//Get focus when document is ready
$("input#inputBoxId").focusin(function (){
alert("This is focus in event.");
});
//Lost focus when document is ready
$("input#inputBoxId").focusout(function (){
alert("This is focus out event");
});
});
</script>
</head>
<body>
<h1>Focus events example</h1>
Input Box:
<input type="text" id="inputBoxId"></input>
</body>
</html>
 
TahirAhmad Dar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks again for your help Bear Bibeault .
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64824
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are still lots of problems with that code. (And please UseCodeTags.)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic