html - tag next to a label in javascript -


i not have luxury of using jquery, want hide span tag in conditions using javascript , span tag not have id.

"<label name="lcity" id="lcity" for="city" class="formlabel" title="city">city:</label> <span class=spanclass>*</span> 

i tried , did not work:

var countyfieldlabel = document.getelementbyid('lcity').nextelementsibling; countyfieldlabel.visibility="hidden"; 

can suggest please?

thanks

you go right:-

visibility not element attribute instead style attribute.

use

 countyfieldlabel.style.visibility="hidden"; 

instead of

countyfieldlabel.visibility="hidden"; 

fiddle


Comments

Popular posts from this blog

python - How to create a legend for 3D bar in matplotlib? -

java - Multi-Label Document Classification -

php - Dynamic url re-writing using htaccess -