user1360809
user1360809

Reputation: 745

Do changes to hidden elements cause a reflow? JS

I have a hidden form element, and it has an input tag with an attribute of 'value'.

Will reading the value of 'value' (using getElementById) cause a reflow? Will changing the value of 'value' (using getElementById & setAttribute) while the element is hidden cause a reflow?

I know different browsers behave differently but was just looking for some input on this subject. I have also set 'display' to 'none' - will this effect the behaviour of the questions above?

Thanks in advance for any help!

Upvotes: 1

Views: 818

Answers (1)

Chandranshu
Chandranshu

Reputation: 3669

No, reading or writing the value attribute will not cause reflow. See this question and its accepted answer: When does reflow happen in a DOM environment? for more details.

Upvotes: 1

Related Questions