1 前台获取dropdownlist
var currentChannels = $('#ddlCurrentChannel').find("option");
for (var i = 0; i < currentChannels.length; i++) {
if (currentChannels[i].selected == true) {
districtCode.val(currentChannels[i].value);
}
}
<asp:DropDownList runat="server" ID="ddlCurrentChannel" Width="150px">
</asp:DropDownList>
2 Jquery 在td里找指定的a元素
curTd.find("a[id$='aDelete']").hide();
curTd.find("a[id$='aUpdate']").show();
<a id="aEdit" href="#" onclick="OnEditClick(this)">修改</a>
<a id="aDelete" href="#" onclick="OnDeleteClick(this)">删除</a>
3 修改select控件时 选中的是指定值
var checkUpItemValue = curRow.find("input[id$='hdnCheckUpItem']").val();
var objSelects = curRow.find("select[id$='ddlCheckUpItem']").find("option")
for (var i = 0; i < objSelects.length; i++) {
if (objSelects[i].value == checkUpItemValue.replace("T", "")) {
objSelects[i].selected = true;
break;
}
}
4 触发btnSearch按钮后台click事件
$('#<%=btnSearch.ClientID %>').trigger("click");
5 Js验证输入的字符
var isNonNumber = (event.keyCode >= 48 && event.keyCode <= 57) //number
|| (event.keyCode >= 96 && event.keyCode <= 105) //小键盘上的数字
|| (event.keyCode == 8) //BackSpace
|| (event.keyCode == 46) //Delete
|| (event.keyCode == 27) //ESC
|| (event.keyCode == 37) //left
|| (event.keyCode == 39) //right
|| (event.keyCode == 9) //Tab
|| (event.keyCode == 13) //Enter
6在tr中找指定的id元素
curRow.find("input[id$='txtMinSA']")[0].value = minSA;
curRow.find("input[id$='txtMaxSA']")[0].value = maxSA;