Click here to Skip to main content
15,436,002 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to get the value of a textbox in jquery and it shows undefined .


txtRule_No.Value = Request.QueryString["RuleNo"];



this value in jquery is undefined . Can anyone help me on this .

What I have tried:

I tried with this $("#txtRule_No").val() , $("#txtRule_No").value() , $("#txtRule_No").html() ..
Updated 6-Dec-21 18:25pm

1 solution

The most likely cause is that you're using a master page, which causes the IDs to be mangled.
Mastering Web Control ClientID Values in ASP.NET 4 -[^]

If there will only ever be a single instance of the control on the page, set ClientIDMode="Static" on your control.

If the script is embedded within the page, reference the control's ClientID property.

Otherwise, you'll need to find another way to reference the control.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900