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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:10:08+00:00 2026-06-06T23:10:08+00:00

i have a problem with my asp.net mvc3 page. i have a view which

  • 0

i have a problem with my asp.net mvc3 page. i have a view which has a form in it to create a item of a specific model. it looks likt this:

@model testPro.Models.AddItemModel
@{
    ViewBag.Title = "New";
}
@*<h2>New</h2>*@

<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>
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>New Item</legend>

                <div class="editor-label">
                    @Html.LabelFor(model => model.UserItem.name)
                </div>
                <div class="editor-field">
                    @Html.EditorFor(model => model.UserItem.name)
                    @Html.ValidationMessageFor(model => model.UserItem.name)
                </div>
        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}
<div>
    @Html.ActionLink("Back to List", "Index")
</div>

<script>
    $(document).ready(function () {

        alert("test");
        $("#UserItem_Name").html("bla");
        $("#UserItem_Name").attr('disabled');
    });
</script>

at the end i have my jquery stuff which should change the text-box.

the problem is, nothing is changing and i dont know why

and yes: i have jquery included in the header.

  • 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-06T23:10:10+00:00Added an answer on June 6, 2026 at 11:10 pm

    Try:

    <script type="text/javascript">
        $("#UserItem_name").val('bla');
        $("#UserItem_name").attr('disabled', 'disabled');
    </script>
    

    Things to notice:

    • Your textbox id is UserItem_name, not UserItem_Name which obviously is not the same thing
    • Use .val() to set values of form input fields instead of .html()
    • The .attr() method takes 2 arguments when you want to set an attribute value: 1) the attribute name and 2) the attribute value. You are currently passing only one parameter, so you are basically reading the attribute value, not setting it.

    Also if this code is inside a partial view that you have injected into your DOM after an AJAX request, you should remove the $(document).ready handler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a problem with the asp.net MVC3. when i create a new project
I have a problem with a model in a asp.net mvc3 application. First of
I have one Asp.net MVC3 page which renders details of a Mobile. This page
I have a frustrating problem with an asp.net mvc view containing the Microsoft Chart
i have an asp.net form and an asp:textbox. i have a problem when the
I have an asp.net mvc3 project, it has some reports in aspx web pages.
I have a basic ASP.Net MVC 3 application which has a number of controllers
With ASP.NET MVC3 (Razor) I have a simple page that loads a jQuery UI
I have online form builder appplication in ASP.NET MVC3 with Razor views. It is
I have a ASP.NET MVC 3 view with esentially two forms, but which reside

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.