Problem getting the value of an element
Hi, I'm new as you can tell by my question. What is wrong with this code?
function bt(ans){
$(document).ready(function(){
if (ans==1) {
if ($(".hidn1").val()=="") {
alert(ans);
$(".msg").text("\n\nWhachu gonna have?");
});
}
}
Here is the call:
<button id="bt1" style="background-color:green; color:yellow; height:20px; width:20px;" type="button" onclick="bt(1)"></button>
And here is where the elements are defined:
<textarea id="hidn1" cols="1" rows="1" style="display:none;"></textarea>
<textarea class="msg" style="background-color: black; color: lightgreen; padding-left: 20px;" rows="10" cols="40" readonly></textarea>
When I press the button, nothing happens. I'm new to jQuery and javascript so any help would be appreciated.