Opping Cinchan
Opping Cinchan

Reputation: 71

javascript not working when using 2 element with same id, one is hidden another is shown

im doing frontend job for translating design mockup to webpage. the design have mobile responsive design also.

i do mobile responsive by duplicating an element (same id, but another have additional class to hide the element)

//desktop
<div id="obj" class="container hidden-xs"></div> //javascript works on desktop view

//mobile
<div id="obj" class="container visible-xs"></div> //javascript doesn't work on mobile view 

i have default javascript function that already run (lets say change it's background color), but when i add mobile version it doesn't work on mobile view

maybe i do responsive wrong way, can someone suggest "how the way i should do responsive web" please ?

Upvotes: 0

Views: 513

Answers (0)

Related Questions