用ajax加载的Html 怎么样能够获取到html里面的标签?? htmlajaxajax加载html后操作html的元素 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $('#test input[type=checkbox]').each(function(){console.log(this)}) 不行,没有效果。"test"这个DIV 是用$("#test").append(json); 加载进去的。 <script type="text/javascript"> $(document).ready(function() { $("#select").click(function() { var startdate = $("#startdate").datebox('getValue'); var endate = $("#enddate").datebox('getValue') $.ajax({ type: "post", dataType: "html", url: "../Service/WebService.ashx?Method=GetMealCalendHtml", data: { startDate: startdate, endDate: endate }, success: function(json) { $("#calendaPanel").empty(); $("#calendaPanel").append(json); } }); }); }); function Oncheck(mealdata) { $("#" + mealdata.id + " input[type=checkbox]").each(function() { console.log(this) }); } </script> <table border='0' cellpadding='3' cellspacing='1' align='center' style='background-color: #b9d8f3;'> <tr class='thstyle' id='weekrow'> <td >Wednesday</td> <td >Thursday</td> <td >Friday</td> <td >Saturday</td> <td >Sunday</td> <td >Monday</td> <td >Tuesday</td> </tr> <tr> <td> <div class='dayTD'>2014-10-1</div> <div class='meallist'> <label for='1,1,br'>早</label> <input type='checkbox' value='早' id='1,1,br' /><br /> <label for='1,1,lh'>中</label> <input type='checkbox' value='中' id='1,1,lh' /><br /> <label for='1,1,dn'>晚</label> <input type='checkbox' value='晚' id='1,1,dn' disabled='True'/> </div> </td> <td> <div class='dayTD'>2014-10-2</div> <div class='meallist' id="test"> <label for='1,2,br'>早</label> <input type='checkbox' value='早' id='1,2,br' checked="checked" onclick="Oncheck(this.parentNode)" /><br /> <label for='1,2,lh'>中</label> <input type='checkbox' value='中' id='1,2,lh' checked="checked"onclick="Oncheck(this.parentNode)"/><br /> <label for='1,2,dn'>晚</label> <input type='checkbox' value='晚' id='1,2,dn' checked="true" onclick="Oncheck(this.parentNode)" /> </div> </td> </tr></table> 只是 上面ajax返回的“json”数据 function Oncheck(mealdata) { mealdata.find('input[type=checkbox]").each(function() { console.log(this) }); } <input type='checkbox' value='晚' id='1,2,dn' checked="true" onclick="Oncheck($(this).parent())" /> $('#test input[type=checkbox]').on("click",function(){ $('#test input[type=checkbox]').each(function() { console.log($(this).index()); });}) textarea框中的文字处理 100分求个用js写的类似ppt预览的图片显示 哪位大侠帮忙解决下,按钮变换问题 请问包换的js文件,怎么能得到包含它页面中的其他javascript定义的变量? 请高手帮忙修改程序 怎样在页面中随时调用js函数 删除记录对已经打开的记录集有影响? 如何隐藏CheckBox? 怎样在页面打开“查找”对话框,想象打开“添加到收藏夹”那样 JS给checkbox赋值,后台取值的问题 用firefox调试一段代码,单步运行就是正常的,直接运行就不正常,为什么啊? 手机浏览器地址栏隐藏后就不在显示
$(document).ready(function() {
$("#select").click(function() {
var startdate = $("#startdate").datebox('getValue');
var endate = $("#enddate").datebox('getValue')
$.ajax({
type: "post",
dataType: "html",
url: "../Service/WebService.ashx?Method=GetMealCalendHtml",
data: { startDate: startdate, endDate: endate },
success: function(json) {
$("#calendaPanel").empty();
$("#calendaPanel").append(json);
}
});
});
});
function Oncheck(mealdata) {
$("#" + mealdata.id + " input[type=checkbox]").each(function() { console.log(this) });
}
</script>
<tr class='thstyle' id='weekrow'>
<td >Wednesday</td>
<td >Thursday</td>
<td >Friday</td>
<td >Saturday</td>
<td >Sunday</td>
<td >Monday</td>
<td >Tuesday</td>
</tr>
<tr>
<td>
<div class='dayTD'>2014-10-1</div>
<div class='meallist'>
<label for='1,1,br'>早</label>
<input type='checkbox' value='早' id='1,1,br' /><br />
<label for='1,1,lh'>中</label>
<input type='checkbox' value='中' id='1,1,lh' /><br />
<label for='1,1,dn'>晚</label>
<input type='checkbox' value='晚' id='1,1,dn' disabled='True'/>
</div> </td> <td>
<div class='dayTD'>2014-10-2</div>
<div class='meallist' id="test">
<label for='1,2,br'>早</label>
<input type='checkbox' value='早' id='1,2,br' checked="checked" onclick="Oncheck(this.parentNode)" /><br />
<label for='1,2,lh'>中</label>
<input type='checkbox' value='中' id='1,2,lh' checked="checked"onclick="Oncheck(this.parentNode)"/><br />
<label for='1,2,dn'>晚</label>
<input type='checkbox' value='晚' id='1,2,dn' checked="true" onclick="Oncheck(this.parentNode)" />
</div>
</td>
</tr>
</table> 只是 上面ajax返回的“json”数据
function Oncheck(mealdata) {
mealdata.find('input[type=checkbox]").each(function() { console.log(this) });
}
<input type='checkbox' value='晚' id='1,2,dn' checked="true" onclick="Oncheck($(this).parent())" />
$('#test input[type=checkbox]').on("click",function(){
$('#test input[type=checkbox]').each(function() {
console.log($(this).index());
});
})