值未更新为文本框在MVC3鉴于jQuery的 [英] value not updated to textbox in Jquery of MVC3 view
本文介绍了值未更新为文本框在MVC3鉴于jQuery的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这种说法。
@if (@Model.QuestionType == 5)
{
<div data-role="fieldcontain">
@using (Html.BeginForm("SaveTextBox", "GetQuestion", Model))
{
@Html.AntiForgeryToken()
<fieldset data-role="controlgroup">
<label for="select-choice-1" class="select">@Model.QuestionText
</label>
<br />
@if (Model.Options != null)
{
foreach (var item in Model.Options)
{
<input type="text" id="textbox1" value="@item.OptionText" name="selectedObjects" />
<span id="username_warning" style="color: red"></span>
}
}
else
{
<input type="text" id="textbox1" name="selectedObjects" />
<span id="username_warning" style="color: red"></span>
}
<br />
@if (Model.Validations != null)
{
<input type="hidden" id="hiddenvalidations" value="@Model.Validations" />
}
</fieldset>
<p>
<input type="submit" id="textboxsubmit" value="Next" />
</p>
}
</div>
}
我正在重定向到基于questiontype同样的观点。所以这个加载时questiontype = 5来了。
i am redirecting to the same view based on questiontype. so this loaded whenever of questiontype =5 comes.
我读在JQuery中的值
i am reading the values in JQuery as
$("#textboxsubmit").live("click", function () {
var textvalue = $("#textbox1").val();
textvalue = jQuery.trim(textvalue);
var validations = $("#hiddenvalidations").val();
alert(textvalue);
alert(validations);
});
我读这个值和验证数据。
I am reading this values and validating the data.
其每次给第一次加载文本框的值。为什么它不更新jQuery的。
its everytime giving the first loaded textbox value. why its not updating in Jquery.
什么用活的问题。如何解决这个问题呢?
whats the issue with live. how do i solve it ?
推荐答案
你的意思呢? textvalue = textvalue + jQuery.trim(textvalue);
Do you mean this? textvalue = textvalue + jQuery.trim(textvalue);
这篇关于值未更新为文本框在MVC3鉴于jQuery的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文