Thank you for your suggestion and the code. Yes, my problem was that I missed entering the pound sign when specifying the ClientID name.
>You should check what the name of that form field really is. If you're using Web Forms and the control is in a container, it'll by something like Ctl1_txtMyTextBox or something along those lines.
>
>Use your DevTools of choice and Inspect Element to find out what hte real ID is then use that name instead.
>
>
>$("#Ctl1_txtMyTextBox").change(...);
>
>
>FWIW, in the past I've used a function that helps me with this:
>
>
>$$ = function (id, context) {
> /// <summary>
> /// Searches for an ID based on ASP.NET naming container syntax.
> /// First search by ID as is, then uses attribute based lookup.
> /// Works only on single elements - not list items in enumerated
> /// containers.
> /// </summary>
> /// <param name="id" type="var">Element ID to look up</param>
> /// <param name="context" type="var">
> /// </param>
> /// <returns type="" />
> var el = $("#" + id, context);
> if (el.length < 1)
> el = $("[id$=_" + id + "],[id*=" + id + "_]", context);
> return el;
> };
>
>
>You can then use it like this:
>
>$$("txtMyTextBox").change(function() { alert('exit') });
>
>
>and it'll find anything that matches this name regardless of the WebForms container prefixes.
>
>+++ Rick ---
>
>>I am trying to incorporate a jQuery Change function in an asp.net page that would make certain control invisible when user starts typing (making changes) in a text box. My initial test, just to call an alert() does not seem to work. Here is my code:
>>
>>
>><script type="text/javascript">
>> $(document).ready(function () {
>>
>> $("txtMyTextbox").change(function () {
>>
>> alert("Change Function Called");
>>
>> });
>>
>> })
>></script>
>>
>>
>>What is wrong with my code? TIA
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham