Hey,
I'm trying to get a textarea's value to update using jquery as outlined in the below code:
<button type="button" onclick="setLine();">Set</button>
<button type="button" onclick="showLine();">fire!</button><p></p>
<textarea id="hello">
</textarea>
<script type="text/javascript">
$('#hello').val("hi there");
</script>
<script type="text/javascript">
function showLine()
{
alert($('#hello').val());
}
function setLine()
{
$('#hello').val('foo');
}
</script>
This code works fine in all major browsers except IE6.
In Ie6 the textarea will not update with the buttonclick and the alert gives a blank/null string. However in other browsers, clicking "set" changes it to "foo" which is then shown in the alert box.
Does anyone know why this is specific to this browser, or what may be wrong with the code? I have my suspicions about the .val()
Any help would be appreciated.