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

my jquery script is not executing

 
Jagdeep Sharma
Ranch Hand
Posts: 121
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys below is my code of external title.js and main file. But it is not working. Please tell me where is the problem.



 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is that you haven't told us what the problem is.

Please read ItDoesntWorkIsUseless.
 
Jagdeep Sharma
Ranch Hand
Posts: 121
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:The problem is that you haven't told us what the problem is.

Please read ItDoesntWorkIsUseless.


I am sorry Bear. Problem is when i use external js file's method inside ready method, all things work fine. But when i use this in external js file, method is not invoked on click event.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are establishing your click event before the DOM is created. That won't work. You need to put that code in a ready handler.
 
Jagdeep Sharma
Ranch Hand
Posts: 121
IBM DB2 Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:You are establishing your click event before the DOM is created. That won't work. You need to put that code in a ready handler.




How can i do it. I want to use click handler in multiple places.



Can i use ready method in external js file.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You've already demonstrated that you know how to establish a ready handler, and yes, ready handlers can be established in external JavaScript files.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic