jeudi 31 mars 2016

More same id´s in document.getElementById("")

I have html file with 157 id´s

id="name"

and i need change style property "display" from "none" to "block" by click on one checkbox On that i have this script :

function nms(){
      if (document.getElementById("name").style.display === 'block') document.getElementById("name").style.display = 'none';
      else {document.getElementById("name").style.display === 'block';}}

which change this property in every single that id.

I need to change it on every not the first id. I just found this :

$("[id=yourID]").

but it didn´t work for me and i can´t use document.getElementByClassName because i need to change display property.

Thanks or your help, i don´t know how to make it run :-(




Aucun commentaire:

Enregistrer un commentaire