Jan Walraven
DevOps



Categories:
  • Arduino (2)
  • CSS (3)
  • Docker (10)
  • ESXi (1)
  • Git (4)
  • Google Cloud (2)
  • Javascript (6)
  • Linux (31)
  • Mac (6)
  • Magento (4)
  • Mysql (13)
  • 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"));
    	});
    	
    });