Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to disable all checkbox within the column when button is clicked
    primarykey
    data
    text
    <p>I am a newbie when it comes to jquery and am getting muddled on my problem. Basically what I need to do is when the button is clicked, all checkbox within that column should be disabled, meaning i cannot check/uncheck it. I have searched and found <a href="https://stackoverflow.com/questions/1426419/disable-all-check-boxes-inside-a-table-with-jquery">this post</a> as the closest one related to my problem but he's already advanced in terms of using jquery and providing only his' pseudo code.</p> <p>Can anyone help me with my problem? Below is my code:</p> <pre><code>&lt;table id="key_table" border="3"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt; Month 1&lt;button id="1" class="lockButton"&gt;Lock&lt;/button&gt;&lt;br&gt;2013-01-01 to 2013-01-31&lt;br&gt; &lt;table style="width: 250px;"&gt; &lt;tbody&gt; &lt;tr class="odd"&gt; &lt;td style="text-align:center;"&gt;1&lt;/td&gt; &lt;td style="text-align:center;"&gt;2&lt;/td&gt; &lt;td style="text-align:center;"&gt;3&lt;/td&gt; &lt;td style="text-align:center;"&gt;4&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/th&gt; &lt;th&gt; Month 2 &lt;button id="2" class="lockButton"&gt;Lock&lt;/button&gt;&lt;br&gt;2013-02-01 to 2013-02-28&lt;br&gt; &lt;table style="width: 250px;"&gt; &lt;tbody&gt; &lt;tr class="odd"&gt; &lt;td style="text-align:center;"&gt;1&lt;/td&gt; &lt;td style="text-align:center;"&gt;2&lt;/td&gt; &lt;td style="text-align:center;"&gt;3&lt;/td&gt; &lt;td style="text-align:center;"&gt;4&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr class="odd"&gt; &lt;td style="width: 250px;"&gt; &lt;table&gt; &lt;tbody&gt; &lt;tr class="odd"&gt; &lt;td style="text-align:center;width:100px !important;"&gt;&lt;input style="width: 15px !important;" class="kw_460853mo_1" type="checkbox"&gt;&lt;/td&gt; &lt;td style="text-align:center;width:100px !important;"&gt;&lt;input style="width: 15px !important;" class="kw_460853mo_1" type="checkbox"&gt;&lt;/td&gt; &lt;td style="text-align:center;width:100px !important;"&gt;&lt;input checked="checked" style="width: 15px !important;" class="kw_460853mo_1" type="checkbox"&gt;&lt;/td&gt; &lt;td style="text-align:center;width:100px !important;"&gt;&lt;input style="width: 15px !important;" class="kw_460853mo_1" type="checkbox"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/td&gt; &lt;td style="width: 250px;"&gt; &lt;table&gt; &lt;tbody&gt; &lt;tr class="odd"&gt; &lt;td style="text-align:center;width:100px !important;"&gt;&lt;input style="width: 15px !important;" class="kw_460853mo_2" type="checkbox"&gt;&lt;/td&gt; &lt;td style="text-align:center;width:100px !important;"&gt;&lt;input style="width: 15px !important;" class="kw_460853mo_2" type="checkbox"&gt;&lt;/td&gt; &lt;td style="text-align:center;width:100px !important;"&gt;&lt;input style="width: 15px !important;" class="kw_460853mo_2" type="checkbox"&gt;&lt;/td&gt; &lt;td style="text-align:center;width:100px !important;"&gt;&lt;input style="width: 15px !important;" class="kw_460853mo_2" type="checkbox"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr class="even"&gt; &lt;td style="width: 250px;"&gt; &lt;table&gt; &lt;tbody&gt; &lt;tr class="odd"&gt; &lt;td style="text-align:center;width:100px !important;"&gt;&lt;input style="width: 15px !important;" class="kw_456905mo_1" onclick="javascript: update_key_type(456905, 1, 1, this)" type="checkbox"&gt;&lt;/td&gt; &lt;td style="text-align:center;width:100px !important;"&gt;&lt;input checked="checked" style="width: 15px !important;" class="kw_456905mo_1" type="checkbox"&gt;&lt;/td&gt; &lt;td style="text-align:center;width:100px !important;"&gt;&lt;input style="width: 15px !important;" class="kw_456905mo_1" type="checkbox"&gt;&lt;/td&gt; &lt;td style="text-align:center;width:100px !important;"&gt;&lt;input style="width: 15px !important;" class="kw_456905mo_1" type="checkbox"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/td&gt; &lt;td style="width: 250px;"&gt; &lt;table&gt; &lt;tbody&gt; &lt;tr class="odd"&gt; &lt;td style="text-align:center;width:100px !important;"&gt;&lt;input style="width: 15px !important;" class="kw_456905mo_2" type="checkbox"&gt;&lt;/td&gt; &lt;td style="text-align:center;width:100px !important;"&gt;&lt;input style="width: 15px !important;" class="kw_456905mo_2" type="checkbox"&gt;&lt;/td&gt; &lt;td style="text-align:center;width:100px !important;"&gt;&lt;input style="width: 15px !important;" class="kw_456905mo_2" type="checkbox"&gt;&lt;/td&gt; &lt;td style="text-align:center;width:100px !important;"&gt;&lt;input style="width: 15px !important;" class="kw_456905mo_2" type="checkbox"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>You can also check here on <a href="http://jsfiddle.net/zXqCE/" rel="nofollow noreferrer">JSFiddle</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload