javascript - Using $(this) in JQuery -
i have table binding jquery datatable. there 3 check boxes in each table/grid row- book
,modify
,view
. aim check validation when saving grid/table. if of row has 3 check boxes unchecked, want display validation message(i.e. checking @ least 1 checkbox mandatory). check validation wrote code below-
function validate() { $(grid1.fngetdata()).each(function () { if ($(this).has('true')) { return true; } }); return false; }
$(this)
have values -
book: false id: 945 modify: false name: "adgas" view: false
how can re-write code whenever book
,modify
, view
have value false
ps: there can multiple rows unchecked or mixed
function validate() { var allok = true; $(grid1.fngetdata()).each(function () { var row = $(this); if (!row.book && !row.modify && !row.view) { allok = false; } }); return alok; // make `validate` return true if rows validate. }
Comments
Post a Comment