简体   繁体   中英

add listener to asp.net control using jquery

我有一个支票簿列表以及文本框和下拉列表,我想检查用户是否与其中的任何一个交互,并且它们也使用j查询将值应用于其他元素上的样式也有帮助吗?

You can use Jquery like this :

Markup :

<asp:textbox ID='text1' runat='server' Text="a value"></asp:textbox>

Jquery Code :

$("#<%= text1.ClientID %>").live('change',function(){

    if($(this).val() != "")
        //Do Somthing

});

for checkbox :

$("#<%= checkbox1.ClientID %>").live('click',function(){

    if($(this).is(':checked') != "")
        //Do Somthing

});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM