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

Why getting error -[Cannot read property 'style' of null]?

Asked by Anna Ball Jul 12, 2021 363 views 1 answer
Share

About this question

Error ID: -270960303 This page has an error. You might just need to refresh it. Error in $A.getCallback() [Cannot read property 'style' of null] Failing descriptor: {c:CommunityBreakingNews}

enter image description here

Controller:

({ doInit : function(component, event, helper) { //var lWidth = window.innerWidth ; var lWidth = 400; window.setInterval($A.getCallback(function() { helper.handleScroll(component, event,lWidth); } ), 20); } })

Helper:

({ handleScroll: function(component, event,lWidth) { var changeposition = component.get("v.scrollInterval"); var floatElement = document.getElementById('toScroll'); if(changeposition < lWidth xss=removed xss=removed floatElement.style.left = "0px" xss=removed>

Style:

.THIS#scrollDIV{ border: 5px solid; border-radius: 6px; background: beige; height: 50px; margin: 5px; padding: 2px; }
What is the reason for getting and how to resolve this error” cannot read property 'style' of null”?

Your answer

1 Answer

More Salesforce discussions