Problems getting value from textbox that has been hidden
Edit: Figured it out. Using .val() instead of .text() did the trick!
I'm using jQuery in a SharePoint newform. In $(document).ready I hide a column/field (textbox) with the following code:
$("input[title='myField']").parent().parent().parent().toggle();
Then, depending on a choice made in a different column/field (dropdown) I run the same code again to show the textbox.
Furthermore, I have overridden the PreSaveAction function to do some custom validation. This is where I run into problems.
If the textbox mention above is visible, I try to fetch the value of it. However, I always get a blank value. Code:
alert($("input[title='myField']").text());
Does anyone know how work around this?
Thanks!