jQuery transformations in ASP.net 4.0

In jQuery in ASP.net 4.0:

$(“#TextBox1”) becomes $(“<%= TextBox1.ClientID %>”)

What does:

$(“#Button1”) become ?

$(“#TextArea1”) become ?

Same thing (though you have a typo in your TextBox1 statement, you need the # sign still).

$("#<%= TextBox1.ClientID %>")
$("#<%= Button1.ClientID %>")
$("#<%= TextArea1.ClientID %>")

I do not think TextArea1 works the same it is a html control.

$(“#<%= TextArea1.ClientID %>”) ?

How do you do the opposite of:

$(“#<%= Button1.ClientID %>”).click(function (e) {

In other words how do you click Button1 programatically from jQuery?

You want to invoke the click or capture it?

Capturing would be exactly how you showed it:

$("#<%= Button1.ClientID %>").click(function (e) {
e.preventDefault(); });

Invoking/Triggering it would be

$("#<%= Button1.ClientID %>").trigger('click');

You know you can make one in .NET, using the asp:textbox and setting textmode to multiline and setting rows to the number of rows you want (makes it a textarea instead of a textbox).

However, HtmlControls do have a ClientID property, so it should work regardless.

Does the following statement work with .NET 4.0, ASP.net 4.0 and jquery-1.4.1.js:

$(“#<%= Button1.ClientID %>”).trigger(‘click’);

It should. After all, it is just a button.