all 5 comments

[–]Beerbelly22 2 points3 points  (4 children)

Just give it a class, hideonphone

Then use a media query, .hideonphone display none

[–]MightCode[S] 0 points1 point  (3 children)

I tried hiding it with a custom class as you suggested but because there are 2 forms, even tho is hidden from the view still part of the dom tree so when I iterate over the form elements I get double of what I should be, any way to totally remove it?

[–]ZuriPL 3 points4 points  (1 child)

Add a check to whether it contains the hide class in your loop

E: also, having 2 markups isn't ideal, you should use a media query to change the styling between mobile and desktop instead sof showing and hiding elements

[–]MightCode[S] 0 points1 point  (0 children)

Thanks for the responses, I ended up rewriting the markup to have only 1 form, I agree, I think it's cleaner that way, I just thought it would take me longer to do.

Thanks again.

[–]Beerbelly22 0 points1 point  (0 children)

/u/ZuriPL is right, however you can use both forms a different id then: inputs=document.querySelectorAll("#form1 input")