Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi...
I am making a user control in which I want to make a listbox visible on click event of a textbox using javascript.

I am not able to get id of listbox using getElementByID property. It is returning null.

Please Help...
Posted

hello,

getElementByID should be getElementById


javascript is case sensitive
 
Share this answer
 
"I am not able to get id of listbox using getElementByID property. It is returning null."
I don't know where to start as there is so much wrong about his question.

First: You don't get the id via getElementById. It's the DOM element you fetch via it's HTML attribute "id".
Second: getElementById isn't a property, but rather a function. ( One could argue of course that getElementById is a javascript object's property that is sometimes bound to a function which returns a DOM element by it's id.)
Third: The server side id property of an ASP tag has nothing to do with the client side HTML tag attribute id. If you want to fetch the client side id of an ASP.Net control, you have to use the property ClientId

Hope this helps you sort this out.

Best Regards,

—MRB
 
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