Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 282
  • Last Modified:

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
0
ayha1999
Asked:
ayha1999
  • 2
  • 2
2 Solutions
 
GaryCommented:
$(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_bravo1Commented:
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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now