samyNathan P
samyNathan P

Reputation: 77

checkbox checked or unchecked based on the value Display?

i am using check box results input page i have check box code looks like

   <input name="upfrontMIPPc" id="upfrontMIPPc1" type="text" class="txt" size="3" maxlength="3" onChange="javascript:upfrontMIPPcChanged(true)" />

 <div class="col-md-1 padding-lft" style="right:13px;top:3px">
      <input id="chkUFtoLoan-1" name="S"  type="checkbox" /> 
    </div>

this check box name pass another page i have using php file i have used post method Looks like

 $S = $_POST["S"];

Results i have two section of value of check box

 1.About Your Loan

 2.Buyer Cost To Close
  

Check box input fields name value upfront MIP.
if the user checked the Include In Calc button from the input page.
They should all be defaulted to checked (as we are defaulting to adding the UPFRONT MIP balance to the loan).

Upvotes: 0

Views: 1145

Answers (1)

Somayeh Ghazvinian
Somayeh Ghazvinian

Reputation: 142

Try this:

$(document).ready(function(){
    var check;    
    // Example 1 - With checked
    $("#test1").on("click", function(){
        if(checkbox1.checked) {
            alert("checked.");
        } else {
            alert("unchecked.");
        }
    });  

    // Example 2 - With jQuery is, NOTE - :checked
    $("#test2").on("click", function(){
        check = $("#checkbox1").is(":checked");
        if(check) {
            alert("checked.");
        } else {
            alert("unchecked.");
        }
    });    


});

Upvotes: 2

Related Questions