Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Salesforce
  3. Question
Salesforce

Why getting error can not read property 'value' of null?

Asked by Andrea Bailey Jul 19, 2021 768 views 1 answer
Share

About this question

I am trying to get the value of a text field in a VF page in JavaScript. Below is my VF page and getting the error “cannot read property of null”.

 [removed] function initialize(){ alert('called' + document.getElementById("thePage:theform:atextId").value); } [removed] 
When I click the link I get this error in the inspect window. Cannot read property 'value' of null I might be missing something here. I checked the path of the text field using inspect window and I saw: <input id="thepage:theform:atextId" maxlength="8" name="thepage:theform:atextId" size="20" type="text" value="731645"> What am I missing here. How to resolve this,why do I get a null?

Your answer

1 Answer

More Salesforce discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Salesforce Blogs

Guides, tips and career advice on Salesforce from JanBask experts.