Access a text box from jQuery

I am new to .Net and jQuery and trying to access a text field via jquery but cant get it working, can anyone help?

+3
source share
4 answers

ASP.NET Breaks Up Your Client Identifiers - Microsoft Not Satisfied! Do you have access to the ClientID repository?

var textboxclientid = '<%=textbox.ClientID%>';
$('#' + textboxclientid).val('horray');
+5
source
$("#your_textboxID");

Mark this link

Description: select one item with the given id attribute.

jQuery ("#id")

id: identifier to search specified through the id attribute of the element.

+1
source

Give your Textbox a unique css class, then use `$ ('. Classname'). val (). Thus, you do not need to do inline coding, for example, "<% = textbox.ClientID%>".

IMHO - a cleaner solution ....

0
source

This should work:

$("#TextBox1").val("Result");
0
source

Source: https://habr.com/ru/post/1711321/


All Articles