在jQuery中有任何方法可以区分回发下拉列表和非回发下拉列表(ASP.NET 3.5):
$('select').change(function(e)
{
//something like this
if ($(this).attr('AutoPostback') == true)
{
//do something here
}
else
{
//do something else
}
Run Code Online (Sandbox Code Playgroud)
认为必须从脚本调用服务器端功能来确定AutoPostback.
通常,要回发的下拉列表将具有一个 onchange 属性,其中包含类似“__doPostBack(”)的内容,尽管其中还会有一些其他内容。
所以你可以做类似下面的事情,我没有测试,所以希望没有错别字
$('select[onchange*="__doPostBack("]').change(...your handler for postbacking control...);
$('select:not([onchange*="__doPostBack("])').change(...your handler for non-postbacking control...);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2803 次 |
| 最近记录: |