SHARE
TWEET

Untitled

a guest Jul 21st, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <div class="row" th:each="bytesaver : ${bytesaverList}">
  2. <div class="col-md-12 col-sm-12 col-xs-12">
  3.     <div class="x_panel">
  4.         <div class="x_title">
  5.             <h2 th:text="${bytesaver.name}">Bytesaver 1</h2>
  6.             <div class="clearfix"></div>
  7.         </div>
  8.         <div class="x_content">
  9.             <div>
  10.                 <table class="table table-bordered">
  11.                     <thead>
  12.                         <th>
  13.                             <input type="checkbox" class="form-control flat" name="checkBoxByteSaver" th:value="${bytesaver.name}"/>
  14.                             Select All
  15.                         </th>
  16.                     </thead>
  17.                 </table>
  18.             </div>
  19.  
  20.         </div>
  21.         <!-- x_content -->
  22.     </div>
  23.     <!-- x_panel -->
  24. </div>
  25. <!-- available IP List -->
  26.      
  27. $(document).ready(function() {
  28.  
  29. var selectAllBoxs = document.getElementsByName("checkBoxByteSaver");
  30. console.log("total element count: "+selectAllBoxs.length)
  31. for (var i = 0; i < selectAllBoxs.length; i++) {
  32.     //selectAllBoxs[i].change(selectAll);
  33.     console.log("Value: "+selectAllBoxs[i].value +" boolean: "+selectAllBoxs[i].addEventListener);
  34.  
  35.         selectAllBoxs[i].addEventListener ("CheckboxStateChange", selectAll, false);
  36.  
  37. }
  38. }
  39.  
  40. function selectAll(){
  41.     console.log("Select All pressed");
  42. }
  43.      
  44. selectAllBoxs[i].addEventListener( 'change', function() {
  45.         if(selectAllBoxs[i].checked) {
  46.             console.log("Some checkbox is selected. Value: "+selectAllBoxs[i].value);
  47.         } else {
  48.             // Checkbox is not checked..
  49.             console.log("Some checkbox is unselected. Value: "+selectAllBoxs[i].value);
  50.         }
  51.     });
  52.      
  53. if (selectAllBoxs[0].addEventListener) {
  54.     for (var i = 0; i < selectAllBoxs.length; i++) {
  55.        selectAllBoxs[i].addEventListener("change", selectAll, false);
  56.      }
  57.     } else if (selectAllBoxs[0].attachEvent) {
  58.      for (var i = 0; i < selectAllBoxs.length; i++) {
  59.        selectAllBoxs[i].attachEvent("onchange", selectAll);
  60.      }
  61.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top