Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
101
rated 0 times [  108] [ 7]  / answers: 1 / hits: 27664  / 14 Years ago, tue, july 13, 2010, 12:00:00

I have a hidden asp.net MVC control in the form:



<%= Html.HiddenFor(m => m.NodeId) %>


My JavaScript / jQuery code:



var DeleteEntireItem = '<% = btnDeleteEntireMenu.ClientID%>';
var Node;
debugger;

$('#' + DeleteEntireItem).click(function () {
Node = NodeValue;
document.forms[0].submit();
});


How can I assign the value of variable 'Node' to the asp.net MVC hidden control?


More From » jquery

 Answers
36

You can set the value attribute of a hidden input tag by selecting it using the property name and using the jquery val() method.



In your case this becomes:



$(#NodeId).val(Node)

[#96254] Saturday, July 10, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
demondp

Total Points: 154
Total Questions: 97
Total Answers: 99

Location: Mali
Member since Thu, Jul 9, 2020
4 Years ago
;