$(":checkbox").click(function(){ if ($(this).attr("checked") == true) { $(this).next("input").attr("disabled","disabled"); } else { $(this).next("input").removeAttr("disabled"); } });