0

In my ASP.Net 2008 app I've got a page that uses a Master Page and I want to use jquery/javascript but I can't even get this simple code to work. the page loads and controls display but no alert.

Ideas?

<asp:Content ContentPlaceHolderID="cphMain" runat="server" ID="mainBodyContent">
    <script type="text/javascript" src="../../js/jquery-1.4.1.js">
    $(document).ready(function() {
        alert("Hey");          

    });
 </script>
 ....
other controls
...

1
  • Did you check if the browser reports any errors? Commented Feb 15, 2011 at 20:24

1 Answer 1

3

You can either have the src attribute set of the script element or have it contain script in its body. Not both in the same time.

Sign up to request clarification or add additional context in comments.

1 Comment

this works <script src="../../js/jquery-1.4.1.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function() { alert("Hey"); });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.