Click here to Skip to main content
12,510,403 members (50,143 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: Javascript PHP
Hi all
i want to get the value of this id...

var val='categoryName_'+value2;
 
  var value1=document.getElementById('categoryName_'+value2).value;
Posted 29-Dec-12 1:10am
Updated 29-Dec-12 1:13am
v2
Comments
jibesh 29-Dec-12 7:29am
   
what error you are getting ?
GeekBond 29-Dec-12 9:04am
   
What is stopping you from getting it?
Sandeep Mewara 29-Dec-12 12:52pm
   
And the issue is?
SureshDasari1986 30-Dec-12 9:12am
   
what is the control element for this id 'categoryName_'+value2,
check the id of the control in browser view source.
AshishChaudha 31-Dec-12 6:07am
   
what control you are using???
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

it gives result
var val='categoryName_'+value2;
 
  var value1=document.getElementById('categoryName_'+value2).value;
please give what is your error or problem.....
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

better you use pass temp variable To get the value.


var val='categoryName_' + value2;

var value1=document.getElementById(val);

//if it is just ID this works
alert(value1.innerHtml);

But, cant get the value of the server side controls because it wont allow the usage of (.clientID) , during string concatenation.
  Permalink  
v2
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

It should work ... What error or issue you are facing ? Elaborate your situation please
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160929.1 | Last Updated 18 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100