user3125430
user3125430

Reputation: 1

Get Value from Text Box using jquery .aspx page used Master page

I have pass Id of text box contol and want to retrive value..

  function GetTextval(id) 
        {var value = $('#<%=' + id + '.ClientID %>').val();
         alert(value);
          }

Upvotes: 0

Views: 747

Answers (2)

Muhammad Rashid
Muhammad Rashid

Reputation: 583

try this

$("#"+<%= id.ClientID %>+"").val();

Upvotes: 0

Zaheer Ahmed
Zaheer Ahmed

Reputation: 28588

You cannot call clientId on client-sided variable, you need to pass parameter to function in a way that it is already converted to client id:

function GetTextval(id){
  var value = $('#'+id).val();
  alert(value);
}

and on calling function:

GetTextval(this.id);

or

GetTextval(<%= ControlId.ClientID %>);

Upvotes: 1

Related Questions