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

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -