开发者

Textarea return empty alert , i use all thy way by name ,class , id , but still empty alert in jquery

<textarea name="comt_graph" id="coment_group_value"
    rows="5" style="width:275px; border:1px solid #D6403F;"></textarea>

and jquery code is

$(document).ready(function (){
    $('.group_coment').live('click',function (){
        var coment_val = $('#coment_group_value').val();
       开发者_运维知识库 alert(coment_val);
        return false;
    });
});


Hi i check it in js fiddle but it work fine for me

Working example

Are you use the developing tools for this ? your code is working...

Error script in another place can make you code stopped working. Try to check your syntax


From the code you've provided, there is no group_coment class in your HTML.

Either:

  • add class="group_coment" to your textarea element, or
  • change the jQuery selector; replace .group_coment with #coment_group_value

Or, if this is the only textarea element on the page, you could replace .group_coment with textarea.


There is no group_coment class in your HTML. Either provide a class in HTMl or write this code for check the value of the textarea.

`$(document).ready(function (){

    var coment_val = $('#coment_group_value').val();
    alert(coment_val);

});`

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜