SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My ascx looks like this:

<SharePoint:ScriptLink ID="ScriptLink1" runat="server" Name="/_layouts/1033/MyProject/js/test.js"/>
test: <input id="example" /> 

test.js looks like this:

$(document).ready(function () {

In MyProject I have a folder called js and in that folder I have test.js

I was under the impression that when I debugged my webpart it would pop up an alert taht said "test" but it does nothing. Am I doing something wrong here?

share|improve this question
up vote 3 down vote accepted

Do you have a reference to jquery on the page before the test.js include? Try using

Are there any script errors, is jquery loaded, try testing this before the alert:

if (typeof jQuery == 'undefined') {   
    alert('jQuery not loaded')   

Try adding this at the top of your include to make sure the include path is right

alert('test.js loaded')   

Is it a VS2010 project? You need to add one of the sharepoint mapped folders, say LAYOUTS, and make your folder stucture under that (can't start with a folder called js)

share|improve this answer
Sorry, I left the jQuery part out. It is in my actual code, just didn't copy it over. I have not added the LAYOUTS folder yet so that is probably the problem. Is it just as simple as creating a folder called LAYOUTS or is there more to it? – Abe Miessler Apr 11 '11 at 15:15
For anyone interested in how to add Mapped Folders see this link: – Abe Miessler Apr 12 '11 at 3:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.