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

Are you unable to capture div's style.display value lwc?

Asked by Krishna Dwivedi Aug 16, 2021 1.6K views 1 answer
Share

About this question

I'm trying to capture the display css property value for an element. However, unless I set style.display value in js it does HTML:


CSS:

.dropdown{ position: absolute; display: none; background: white; }

JS: Below JS method is be called from one of the input boxes in html:

updateDropDownStyle(){ console.log('display : ' ,this.template.querySelector('.dropdown').style.display); }

However, the console prints nothing at all. However, if in the same method I set the element.style.display value as none and then try to console the above - it prints none. What's the issue here?

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.