jquery and asp.net master page - broken reference

This may be more of an ASP.NET masterpage problem, but it involves jquery and a jquery plugin, so I'm posted it in both places.

In my ASP.NET webapp (v3.5), when I started using masterpages I got strange javascripting behaviors and had to start using RegisterStartupScript and RegisterClientScriptBlock in the codebehind of master to solve the problems.

But I have 1 more js problem, possibly related. In one of my aspx pages (not master) I have these 2 js references:
<script type="text/javascript" src="Scripts/jquery-1.4.4.js" />
<script type="text/javascript" src="Scripts/putCursorAtEnd.js" />

Open in new window


Then in the aspx page it references a usercontrol that contains some jquery script that references the putCursorAtEnd.js. Again, before I started using masterpages everything worked perfectly. Afterward, the jquery executes fine but it can't find the putCursorAtEnd function. Behaves exactly as if that reference to the .js file were not there. Yet obviously the jquery js file is being seen because all the jquery stuff works fine.

When I tried, just for a test, to paste the entire contents of putCursorAtEnd.js at the end of jquery-1.4.4.js" , it works fine. That's not a good long-term solution, but it's worth noting.

Any ideas why the referenced putCursorAtEnd.js does not seem to be found?
LVL 11
SweatCoderAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Albert Van HalenConnect With a Mentor Analyst developerCommented:
Use <script></script> instead of <script />
0
 
MrunalCommented:
hi

you have to include these files in master page in head tag. this is preferable way to include js files.

Hope this solves your problem.
0
 
SweatCoderAuthor Commented:
mroonal: Same exact problem when I moved the js file references to Master. jquery works, putCursorAtEnd.js isn't recognized.

Other ideas?
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
SweatCoderAuthor Commented:
Albert,

That fixed it! But I can't understand why closing off the js script reference one way rather than another makes any difference. I thought they were identical for purposes of referencing a js file.
0
 
Albert Van HalenAnalyst developerCommented:
There are plenty of discussions going on, and there are explanations.
See http://stackoverflow.com/questions/69913/why-dont-self-closing-script-tags-work for example.

I just do it always with a closing tag. (learned the hard way...)
0
 
SweatCoderAuthor Commented:
Lots of grief over a little thing. :-)  Thanks again.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.