Strangeplant
10-26-2015, 02:20 PM
I have several rows of text boxes, in pairs. Pairs are so I can check changed states for updating a mysql database. Program is php that writes the html. So, when the first (left) check box is changed, the complement (right in the pair) must be changed to the opposite state, checked or unchecked. The second (right) one of the pair will be thrown off page so it will not be seen. It is disabled anyway, so it cannot be manually changed. The code that results from the php writes basically looks like this for one of the several lines:
<td><input class="boxer" name="tablite['name']" type="checkbox" /></td>
<td><input class="boxes offscreen" name="untablite['name']" type="checkbox" disabled="disabled" /></td>
<td><input class="boxet" name="plotite['name']" type="checkbox" /></td>
<td><input class="boxeu offscreen" name="unplotite['.$lineitem['profilenum'].']" type="checkbox" disabled="disabled" /></td>
<td class="boxes">some value</td><td class="boxed">some text</td>'."\n";
Then there is the jQuery, which doesn't work like I think it should. It is supposed to change the checked to unchecked, or the other way around:
$('.proxi').change(function () {
var checkbx = $(this).next('input[type="checkbox"]'),
dis = checkbx.prop('checked');
checkbx.prop('checked', !dis);
});
I have tried everything that I can think of, but I can't get to the input in the next td. proxi is the class name of the table, and I do know that it does get into the function. Can someone suggest a way to change the property of the 2nd and 4th input when the 1st and 3rd are changed?
<td><input class="boxer" name="tablite['name']" type="checkbox" /></td>
<td><input class="boxes offscreen" name="untablite['name']" type="checkbox" disabled="disabled" /></td>
<td><input class="boxet" name="plotite['name']" type="checkbox" /></td>
<td><input class="boxeu offscreen" name="unplotite['.$lineitem['profilenum'].']" type="checkbox" disabled="disabled" /></td>
<td class="boxes">some value</td><td class="boxed">some text</td>'."\n";
Then there is the jQuery, which doesn't work like I think it should. It is supposed to change the checked to unchecked, or the other way around:
$('.proxi').change(function () {
var checkbx = $(this).next('input[type="checkbox"]'),
dis = checkbx.prop('checked');
checkbx.prop('checked', !dis);
});
I have tried everything that I can think of, but I can't get to the input in the next td. proxi is the class name of the table, and I do know that it does get into the function. Can someone suggest a way to change the property of the 2nd and 4th input when the 1st and 3rd are changed?