Jan Walraven
DevOps



Categories:
  • Arduino (2)
  • CSS (3)
  • Docker (11)
  • ESXi (1)
  • Git (4)
  • Google Cloud (3)
  • Javascript (6)
  • Kubernetes (4)
  • Linux (36)
  • Mac (7)
  • Magento (4)
  • Mysql (14)
  • PHP (9)
  • Zend framework 2 (9)
  • Posted on July 16, 2013

    This code toggle’s the checkbox value by clicking on the description. The code is useable for all checkboxes on your website.

    CSS

    
    .chkBoxTxt{
    	cursor:pointer;
    }
    
    input[type="checkbox"]{
    	 width: 13px;
        height: 13px;
        padding: 0;
        margin:0;
        vertical-align: bottom;
        position: relative;
        top: -1px;
        *overflow: hidden;
    }
    
    

    HTML

    
    
    Agree with terms

    Jquery

    
    $(document).ready(function(){
    	
    	$('.chkBoxTxt').click(function(){
    		var checkBox = $(this).parent().find('input[type="checkbox"]');
    		checkBox.prop("checked", !checkBox.prop("checked"));
    	});
    	
    });