Jump to content

Recommended Posts

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?

<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();">

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.