Reputation: 627
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.
Upvotes: 0
Views: 64
Reputation: 10896
try something like this
if(document.getElementById("vehicleLoan").checked)
{
$("#Loan").removeAttr("style","display:block");
}
else
{
$("#Loan").removeAttr("style","display:none");
}
Upvotes: 0
Reputation: 22711
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();
}
}
Upvotes: 1