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 9015643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:47:59+00:00 2026-06-16T03:47:59+00:00

I usually refer a jQuery using: <script src=’@(Url.Content(~/JavaScript/jquery.maskedinput-1.2.2.js))’ type=text/javascript></script> I refer the same Jquery

  • 0

I usually refer a jQuery using:

<script src='@(Url.Content("~/JavaScript/jquery.maskedinput-1.2.2.js"))' type="text/javascript"></script>

I refer the same Jquery in many Pages. Any change to the static content (name or version number) requires that all views are updated to absorb the change.In order to solve this I tried creating routes in Global.asax for Jquery file like below

routes.MapRoute("jquery.maskedinput.js", "Javascript/jquery.maskedinput-1.2.2.js");

and i tried to call it in cshtml using a Html Helper like below

 <script src='@Html.RouteLink("maskedinput","jquery.maskedinput.js") ' type="text/javascript"></script>

I know RouteLink returns a Anchor tag and so the Source is not rightly set for the Jquery to load.

Requirements:

  1. Is there any other Html helper which can return only the virtual
    path (or)
  2. I need to reference Jquery with a name not with a path. The path
    should be declared somewhere globally so that a single change in the
    global file can solve the purpose.

Help me, please.

  • 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-16T03:48:01+00:00Added an answer on June 16, 2026 at 3:48 am

    I use this method for my BundleCollection with System.Web.Optimization see my question, but this still works even with out it.

    namespace PROJECT.Classes
    {
        public class JSBundles
        {
            public static string Test = "/scripts/test.js";
        }
    

    then use it like this:

    <script src='@(JSBundles.Test)' type="text/javascript"></script>
    

    which renders

    <script src='/scripts/test.js' type="text/javascript"></script>
    

    Note that this requires a reference in your view to PROJECT.Classes or wherever you put it. I’ve got that setup in my web.config in the views folder.

    ....
    <add namespace="PROJECT.Classes" />
          </namespaces>
        </pages>
      </system.web.webPages.razor>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Usually, on twitter tweet button, if I don't specify data-text it take the page
Usually (if not always), when jQuery allows you to add a callback to some
in zend framework, i usually setup vhosts so that i can refer to my
When reading about the crossover part of genetic algorithms, books and papers usually refer
Usually, the best practice in python, when using international languages, is to use unicode
When I refer to Android screen I usually use two words page and screen.
When I need to disable/re-enable validator I usually use jQuery code like so: ValidatorEnable($('[id*=DueDateRequiredValidator]')[0],
What does this refer to in the init function below from jQuery latest When
Consider: <form action="?login" method="post"> <button>Login with Google</button> </form> I usually see the action refer
I know this might be a stupid question to many but I usually like

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.