How about a simple alert statement to see if that is even triggering. If not, do you use firebug? I would load it up and see if anything is missing or what the actual error is.
-----Original Message----- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Greg Sent: Wednesday, August 26, 2009 12:00 AM To: jQuery (English) Subject: [jQuery] Re: Event Not Triggering On External JS Files @Meroe: That was kind of pseudo-code so I checked anyway and there's no spaces in the actual code. @James: No, it doesn't work if I put the jQuery script tag in the head. I was wondering if it had something to do with preventing XSS? There is an ajax call to the button.js's domain (which could be the reason). On Aug 25, 9:44 pm, James <james.gp....@gmail.com> wrote: > Does it work if you put your jquery library at the top? (In the > <head>) > > On Aug 25, 12:31 pm, Greg <greg.heid...@gmail.com> wrote: > > > I built a small JavaScript file that does some HTML and CSS > > manipulation when you hover over any tag with a certain class. It > > works great when running on the same server, but if I try to use the > > JS as an external script, the hover event isn't triggering. > > > Here is my external JS file code: > > > $(document).ready(function() { > > alert('i work inside'); > > $(".start").hover( > > function (e) { > > $(".button").css( { 'display':'none', 'position':'relative', > > 'left':'150px', 'top':'-10' } ); > > $(".button").fadeIn(500); > > }, > > function (e) { > > $(".button").remove(); > > });}); > > > alert('i work outside'); > > > Here is my include code on the HTML page: > > <div> > > <span class="start"><button>Yes</button></span> > > </div> > > <script type="text/javascript" src="http://ajax.googleapis.com/ajax/ > > libs/jquery/1.3.2/jquery.min.js"></script> > > <script type="text/javascript" src="http://mydomain.com/js/ > > button.js"></script> > > > When I hover over that span, it does not trigger the code in > > "button.js", Any ideas? > > > Thanks in advance.