0

I am writing a code for kendo UI mobile in which i want to show a particular div on check on of check box for this i am writing a function as follows

           function showDetails(){
              // debugger;
               var data = $("#vehicleLoan").attr('checked');
               // alert(data);
               if(data)
               {
                   $("#Loan").removeAttr("style","display:block");
               }
               else
               {
                   $("#Loan").removeAttr("style","display:none");   
               }
           } 

but i am getting an undefined at data.

Trupti
  • 597
  • 4
  • 8
  • 17

2 Answers2

1

Can you try using,

var data = $("#vehicleLoan").is(':checked');

OR

    function showDetails(){
               $("#Loan").toggle();
     }

OR

    function showDetails(){
          // debugger;
           var data = $("#vehicleLoan").is(':checked');
           // alert(data);
           if(data)
           {
               $("#Loan").show();
           }
           else
           {
               $("#Loan").hide();   
           }
       } 
Krish R
  • 22,583
  • 7
  • 50
  • 59
0

try something like this

   if(document.getElementById("vehicleLoan").checked)
   {
       $("#Loan").removeAttr("style","display:block");
   }
   else
   {
       $("#Loan").removeAttr("style","display:none");   
   }
rajesh kakawat
  • 10,826
  • 1
  • 21
  • 40