Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8020281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:38:50+00:00 2026-06-04T21:38:50+00:00

Just a standard MVC site, however I tried to add a JQuery on document

  • 0

Just a standard MVC site, however I tried to add a JQuery on document ready handler to my home view rather then my layout page and found that it would not execute it when I did so.

Layout Page:

<!DOCTYPE html>

<html>
    <head lang="en">
        <meta charset="utf-8" />
        <title>@ViewBag.Title</title>
        <link href="@Url.Content("~/Content/Reset.css")" rel="stylesheet" type="text/css" />
        <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
        <script src="@Url.Content("~/Scripts/modernizr-2.5.3.min.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/jquery-1.7.2.min.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/jquery-ui-1.8.20.min.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
        <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
        @RenderSection("Head");
    </head>

    <body>
        <header id="header">
            <h1>Home</h1>

            <nav id ="nav">
                <a href="@Url.Action("Index", "Home")"><div>Home</div></a>
                <a href="@Url.Action("AboutMe", "Home")"><div>About Me</div></a>
                <a href="@Url.Action("Index", "Project")"><div>My Projects</div></a>
                <a href="@Url.Action("Index", "Contact")"><div>Contact Me</div></a>
                <a href="@Url.Action("Index", "Blog")"><div>Blog</div></a>
            </nav>
        </header>

        <section id="content">
            @RenderBody()
        </section>
    </body>
</html>

Home Page:

@{
    ViewBag.Title = "Home";
}

@section Head
{
    <link href="@Url.Content("~/Content/HomeIndex.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/Jquery.Tweet.css")" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="@Url.Content("~/Scripts/jquery.tweet.js")"/>

}

<img id="home-image" alt="Home page image" src="..." width="300" />

<section id="introduction">
    <h3>WelcomeLi</h3>
    <p>Text goes here.<p>
</section>

<section id="get-in-touch">
    <h4>Get In Touch</h4>
    <img id="facebook-button" alt="Find me on Facebook." src="@Url.Content("~/Content/Images/FacebookButton.png")" />
    <img id="skype-button" alt="Contact me via Skype." src="@Url.Content("~/Content/Images/SkypeButton.png")" />
    <img id="linkedin-button" alt="Find me on LinkedIn" src="@Url.Content("~/Content/Images/LinkedInButton.png")" />
</section>

<section id="twitter"></section>

So basically what I did was added a jquery document ready handler to the head on my layout page, it executes fine, however if I add the script section into the head section of my home view it will not execute. Can someone explain why this is happening? It does not make any sense to me.

Also when I view the source the page looks like it is rendering fine with the script in the right place and correctly formatted, this has me stumped, any help is much appreciated.

Thanks,
Alex.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:38:52+00:00Added an answer on June 4, 2026 at 9:38 pm

    As far as i know you cannot self-close a < script > tag

    so please correct the:

    <script type="text/javascript" src="@Url.Content("~/Scripts/jquery.tweet.js")"/>
    

    to

    <script type="text/javascript" src="@Url.Content("~/Scripts/jquery.tweet.js")"></script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a couple ASP MVC websites just using the standard VS templates default
I'm trying to add a View to an arbitrary folder in my MVC project
The standard route for the MVC Web API is {controller}/{id}. However I'd like to
I have a standard ASP.NET MVC site with forms authentication. Users log in via
I'm just starting out in MVC world, and I've used a standard MVC template
What's ActivePython actually about? From what I've read it's just standard Python with OpenSSL
I just tryed the standard way for adding CToolbar to a dialog on the
If I just include existing Standard C++ class in C++/CLI program, will it work?
I just created my first MVC2 project using the standard template. I need to
I have a really standard splash screen, just a simple Default.png, but for whatever

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.