JudgementDay Posted February 4, 2012 Share Posted February 4, 2012 I am getting a JavaScript warning: Use of getAttributeNode() is deprecated. Use getAttribute() instead. It is triggered when I type in a HTML TEXTAREA. This is the relevant code: <SCRIPT type="text/javascript"> function validateForm() { if (document.forms["form"]["feedback"].value == "") { alert ("Cannot submit because feedback has not been given."); return false; } } </SCRIPT> <FORM action="result.html" method="post" name="form" validateForm()"> <DIV> <DIV class="feedback"><TEXTAREA class="feedback" cols="0" name="feedback" rows="0"></TEXTAREA></DIV> <BR> <BR> <INPUT class="verdana" type="submit" value="SUBMIT"> </DIV> </FORM> Why am I getting a warning about getAttributeNode() when I'm not even using it? Quote Link to comment https://forums.phpfreaks.com/topic/256384-getting-a-javascript-warning-for-something-i-am-not-even-using/ Share on other sites More sharing options...
joe92 Posted February 4, 2012 Share Posted February 4, 2012 <FORM action="result.html" method="post" name="form" validateForm()"> That is causing the error I would presume. You cannot just type a JavaScript function into the tag. You have to place it in an event listener. By not doing so it seems to have caused some sort of parsing error, I think. Judging from the function, I would say you need to use onsumbit: <FORM action="result.html" method="post" name="form" onsubmit="validateForm();"> Quote Link to comment https://forums.phpfreaks.com/topic/256384-getting-a-javascript-warning-for-something-i-am-not-even-using/#findComment-1314458 Share on other sites More sharing options...
JudgementDay Posted February 4, 2012 Author Share Posted February 4, 2012 Thats strange, the code I pasted here isn't the code. Perhaps this forum software is stripping it. Lets see: <FORM action="result.html" method="post" name="form" onsubmit="return validateForm()"> If you can see the onsubmit, thats what the code is suppose to be. Quote Link to comment https://forums.phpfreaks.com/topic/256384-getting-a-javascript-warning-for-something-i-am-not-even-using/#findComment-1314588 Share on other sites More sharing options...
joe92 Posted February 5, 2012 Share Posted February 5, 2012 Hmm, well from the code you have provided that error should not be coming up. Are you using any third party libraries like jQuery or Mootools? They often write their own custom event listeners and that could be causing the error. Or are you using any third party text editor tools such as Nicedit or CKeditor? They too might be writing custom event listeners which might be causing the error. Just clutching at straws here. Are you using any third party packages at all? Also, what tool/browser are you seeing the error in? Firefox's firebug is quite useful in that it tells you the line, column and script of the JavaScript error. Quote Link to comment https://forums.phpfreaks.com/topic/256384-getting-a-javascript-warning-for-something-i-am-not-even-using/#findComment-1314806 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.