I have an ASPX page where in I need to set the value of “FirstName” with “YourName”. Both are textboxes. “YourName” is set with visible=false on the page. Problem is Jquery works only visible=true.
My goal is to set Firstname with Yourname with the condition that YourName has visible=false.
Here are the details
<asp:TextBox runat="server" ID="fnameTextBox" />
<asp:TextBox runat="server" ID="ynameTextBox" visible="false" />
<script type="text/javascript">
$(document).ready(function () {
$('input:text[id*=fnameTextBox]').val($('input:text[id*=ynameTextBox]').val());
});
</script>
I can store the value in ‘ynametextbox’ to some other type or variable but I don’t know how to reference in Jquery (if possible).
Here is the example with the
HiddenFieldas requested:Javascript:
HTML
Hidden field is not visible to the user of course, but beware because they can still see the value in the HTML.
Good luck..