Disabling button

Hi,

I have a asp.net text box control in a datalist control and a asp.net button control outside of the datalist. How can I disable the button if user change the value in the text box?

Thanks
LVL 7
ayha1999Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
GaryConnect With a Mentor Commented:
$(document).ready(function () {
$("#textboxid").keyup(function() {
        $("#buttonid").attr('disabled', 'disabled');
});
});

Open in new window

0
 
ayha1999Author Commented:
How can I apply the function to the text box?

Thanks
0
 
Johny BravoConnect With a Mentor Commented:
Rather than id, apply a class to Textbox and change the selector in jquery to class.

You need to add a jquery file in the head also.

$(document).ready(function () {
$(".textboxclass").keyup(function() {
        $("#buttonid").attr('disabled', 'disabled');
});
});

This function will be attached itself when the page is loaded
0
 
GaryCommented:
I don't know, I don't have access to your code or know the id's of your elements.
Do not use classes where you attach an event to a single element.
0
 
ayha1999Author Commented:
Thanks
0
All Courses

From novice to tech pro — start learning today.