Skip to main content

select all checkboxes in a table javascript

function checkAll(bx,dg) {
                                        var tbl = document.getElementById(dg);

                                        for (var index = 1; index < tbl.rows.length; index++) {
                                            var cbs = tbl.rows[index].getElementsByTagName('input');
                                            for (var i = 0; i < cbs.length; i++) {
                                                if (cbs[i].type == 'checkbox') {
                                                    if (cbs[i].disabled == false) {
                                                        cbs[i].checked = bx.checked;
                                                        //alert(cbs[i].disabled);
                                                    }
                                                }
                                            }
                                        }
                                    }

ex: <input type="checkbox" id="chkAll" onclick="checkAll(this,'tableId" />

Comments

Popular posts from this blog

Remove Duplicate Row in Sql Query

Method 1: -- Create Sample Table DECLARE @ table TABLE ( data VARCHAR ( 20 ) ) -- Insert Some Data INSERT INTO @ table VALUES ( 'not duplicate row' ) INSERT INTO @ table VALUES ( 'duplicate row' ) INSERT INTO @ table VALUES ( 'duplicate row' ) -- Find out Duplicate rows in table : SELECT   data , COUNT ( data ) nr FROM     @ table GROUP BY data HAVING   COUNT ( data ) > 1 -- Remove Duplicate rows from table SET NOCOUNT ON SET ROWCOUNT 1 WHILE 1 = 1    BEGIN       DELETE    FROM @ table       WHERE     data IN ( SELECT   data                                FROM     @ table            ...

send push notification from C# using FCM

        public bool SendPushNotification(string deviceId, string message)         {      //applicationID = "AIzaSyxxxxxxxxxxxxxxxxxxx"     // senderId = "98xxxxxxxxx"             bool isSent = false;             string str = "";             try             {                 WebRequest tRequest = WebRequest.Create("https://fcm.googleapis.com/fcm/send");                 tRequest.Method = "post";                 tRequest.ContentType = "application/json";                 var data = new                 {                     to = deviceId,   ...