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 yourtextarea
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);
});`
精彩评论