1
<apex:inputCheckbox styleClass="billCopy">Same as Above To Address </apex:inputCheckbox>

<apex:includeScript value="//code.jquery.com/jquery-1.11.0.min.js"/>
<script>
    var j$ = jQuery.noConflict();
    var addClick = function() {j$('.billCopy').change(function(e) 
        {
         //my logic here
        });
j$(document).ready(addClick);
</script>

when i click on checkbox my logic is working and at the same time if i unchecked the checkbox then also it's executing my logic.Now i want to execute my logic only when checkbox is checked only.

1 Answer 1

2

You need to use is function of the jQuery that returns a boolean:

var addClick = function() {j$('.billCopy').change(function(e) 
{
    if(j$(this).is(':checked')){
        //your logic here
    }
});
0

You must log in to answer this question.