I have a JavaScript code that reads the content of an html textbox and is working on IE and Chrome but is not being recognized by Firefox.
HTML Code:
<div id="SetInner_Form">
<form name="Set_Password" method="post" action="">
Email Address
<input class="Auth" name="SetPwd_Username" type="text"/><br/><br/>
New Password <input class="Auth" name="SetPwd_NewPwd" type="password"/><br/><br/>
Retype Password <input class="Auth" name="SetPwd_RetypePwd" type="password"/><br/><br/>
<div id="SetPwdResultWrapper">
<div id="SetPwdResult" class="Validation_2"></div><br/>
</div>
<div id="RedirectLink" align="center" class="NoDisplay">Click <a href='https://localhost/webapp/index.aspx'>here</a> to go to main page</div><br/>
</form>
<div id="SetPwdBtnWrapper">
<input id="SetPwdBtn" name="SetPwdBtn" type="submit" value="Confirm" align="center"/>
</div>
<img id="LoadingIcon_auth"/>
</div>
Javascript Code:
$("input[name=SetPwd_Username]").val()
Exception (on Firefox console):
Uncaught exception: Syntax error, unrecognized expression: input[name=SetPwd_Username
JQuery version is: jquery-1.6.4.min.js
The weird part is, Firefox can recognize the other html elements except for the SetPwd_Username
Am I missing something?
Try putting the name of the field in single quotes.
$("input[name='SetPwd_Username']").val()
^ here ^ and here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With