如何存储表的已检查复选框值以检查编辑模式? [英] How to store checked checkbox values of a table to check in edit mode ?

查看:86
本文介绍了如何存储表的已检查复选框值以检查编辑模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

When i am in Edit mode i have a Update Button which should be enabled only when checkboxes are changed for example there are 2 records in edit mode :

Branches ||      Manage           ||       Email
ABC      ||  (CheckBox Checked)   || (CheckBox UnChecked)
PQR      ||  (CheckBox UnChecked) || (CheckBox UnChecked)

Now only if i change any of the above checkboxes then only the Update button should be enabled. If i change but again i keep the same above checks then it should again be disabled as new changed value is same as the previous value





我尝试过:



我在每次tr点击时使用jquery但我不知道如何存储每个tr的每个复选框的值,以便在值更改后进行比较。



What I have tried:

I am using jquery on each tr click but i dont know how to store values of each checkbox of each tr to compare after values changed.

推荐答案

检查这个



check this

<html>
<head title="">

    <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.12.4.min.js"></script>
    <script>
        var initialstate = '';
        var changedstate = '';


(function(){
(function () {


('。myclass')。each(function(i, elem){
initialstate + =(elem.checked?'1':'0')+' - ';
changedstate + =(elem.checked?'1':'0')+' - ';
});
('.myclass').each(function (i, elem) { initialstate += (elem.checked ? '1' : '0') + '-'; changedstate += (elem.checked ? '1' : '0') + '-'; });


这篇关于如何存储表的已检查复选框值以检查编辑模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆