日期:2014-05-16 浏览次数:20361 次
<label id="Label1">
<input type="checkbox"/>
</label>
alert($('#Label1')[0].innerHTML);
/////
alert($('#Label1').html());
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<title>无标题文档</title>
</head>
<body>
<label id="Label1">
<input type="checkbox"/>check item
</label>
<script type="text/javascript">
jQuery(function($){
$(":checkbox").click(function(){
if($(this).is(':checked')){
$(this).attr('checked','checked');
}else{
$(this).removeAttr('checked');
}
alert($('#Label1').html());
});
});
</script>
</body>
</html>