日期:2014-05-16  浏览次数:20331 次

jquery给textarea赋值怎么不好用呢?

<form name="form1" action="confirm.nhn" method="post">
<br>
Sex:
<input type="radio" value="1"  name="man.sex">
Male
<input type="radio" value="2" name="man.sex">
Female
<br>
Hobbies:<input type="checkbox" value="1" id="man.hobbie" name="man.hobbie">
Music
<input type="checkbox" value="2" id="man.hobbie"  name="man.hobbie">
Sport
<input type="checkbox" value="3" id="man.hobbie" name="man.hobbie">
Movie
<br>Self Description:<br>
<textarea id="man.description" name="man.description"></textarea><br>
<br>
<input type="button" value="Submit" name="button1" onclick="javascript:deal()">
<br>
</form>
    <script type="text/javascript">
        function deal(){
            document.form1.submit();
        }
          $(function(){
          $('#man.description').text("sssddf");
          })
         
        
 
    </script>


我觉得问题出在选择器上,如果用$('textarea')就正常.晕哪,搜遍了也没发现有人碰见过类似问题.

------解决方案--------------------
首先你要把id中的.去掉,
然后你再把$('#man.description').text("sssddf");
改为$('#man.description').val("sssddf");
因为在ff3。0下text有bug
------解决方案--------------------
方法倒是有,你可以把.前面加2个\\
即. ==> \\.
但没必要ID里有点啊?