Click here to Skip to main content
14,773,207 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I want to get the value of a textbox in jquery and it shows undefined .

CODE

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

JQUERY

$("#txtRule_No").val()


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() ..
Posted
Updated 2-Nov-20 4:38am

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 - 4GuysFromRolla.com[^]

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.
   

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