I have a C# MVC4 application in which I am writing a JQuery function to grab some values, post to an ActionResult and then refresh a partial view. All functionality is working except for setting a new var equal to the value of a variable within one of my div elements.
The pre-existing variable is called myName and is located in a div with an id of NameDiv.
Ive tried these four versions of code and each results in: Reference Error myName is not defined.
var origname = myName;
var origname = myName.value();
var origname = myName.val();
var origname = $('#NameDiv').valueOf(myName);
When running the application and inspecting element, I see that myName is populating with the correct value.
myName- variable, html element, ...?