Sunday, March 10, 2013

textarea and innerHTML In Firefox Doesn’t Work

innerHTML doesn’t work with the textarea tag in Firefox
innerHTML  is a common way to return the value of an html tag.  I was recently working with an AJAX / JQuery application and all was going well.  However, the <strong>innerHTML method wasn’t returning anything with a textarea tag.  All of the other values were coming through just fine with the identical code.
Somewhere in the recesses of my memory I had recalled running in to this in the past (probably blocked out due to the pain!).
Anyway, a quick look on line and I remembered that innerHTML doesn’t work with Firefox.  To return the text in a textarea tag, use the <strong>value</strong> reference instead
use this—> var myText = document.getElementById(‘myTextArea’).value;

0 comments:

Post a Comment