Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Wednesday, December 16, 2015

How to make a tag appear when you click a checkbox

How to make a tag appear when you click a checkbox


How to make this tag appear when a checkbox is clicked? Right now it is hidden.

Bark Bark

Hear a dog

css:

.bark{     visibility: hidden  }    input[type="checkbox"]:checked  {  visibility: visible    }  

Answer by kiran.koduru for How to make a tag appear when you click a checkbox


Using jQuery you can do

if ($('.title:checked')){      $('.bark').show();  }  

Answer by Varun Rao for How to make a tag appear when you click a checkbox


HTML

Bark Bark

Hear a dog

JAVASCRIPT

  

Answer by Digpal Singh for How to make a tag appear when you click a checkbox


    

Bark Bark

Hear a dog

Please include any jquery min js and try this code :

Answer by ketan for How to make a tag appear when you click a checkbox


Without using scripting language there is one trick:

.bark{     visibility: hidden;  }    input[type=checkbox]:checked + .bark {     visibility: visible;  }
Hear a dog  

Bark Bark

You should put h3 after input. And use + sign to make h3 visible.

Working Fiddle

Answer by yjs for How to make a tag appear when you click a checkbox


.bark{     visibility: hidden  }    input[type="checkbox"]:checked + h3.bark  {  visibility: visible    }
Hear a dog  

Bark Bark

Answer by Bijal for How to make a tag appear when you click a checkbox


function checkInput(cbox) {        if (cbox.checked) {            document.getElementById('check_box').style.visibility='visible';          }        else{              document.getElementById('check_box').style.visibility='hidden';         }   }
#check_box{     visibility: hidden;  }

Bark Bark

Hear a dog


Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 71

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.