I have a textarea where the user enters the answer to a question. If he enters the wrong answer, or no answer (just hits the enter key), the script clears the textarea. When it clears the textarea, I end up with a new line that I don't want.
3){--
You received this message because you are subscribed to the Google Groups "Firebug" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebug+u...@googlegroups.com.
To post to this group, send email to fir...@googlegroups.com.
Visit this group at http://groups.google.com/group/firebug.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebug/5bffeedf-a296-44df-a64c-ef349379e081%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I have a textarea where the user enters the answer to a question. If he enters the wrong answer, or no answer (just hits the enter key), the script clears the textarea. When it clears the textarea, I end up with a new line that I don't want.I think you don't need to do anything with Firebug. Add event.preventDefault(); at the end of the function handling the event when a return key is pressed, something like this:
textarea.click = function(event){if(event.keyCode == 13){event.preventDefault();
}}Note |event| is the name of the argument.
Although the answer doesn't relate to the Firebug, but just as way to fix the issue.Farshid
--
You received this message because you are subscribed to the Google Groups "Firebug" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebug+unsubscribe@googlegroups.com.
though his code has a little flaw as it's not the click event you need to react to but the keydown event.