Hi all,
I have a setup looking like this:
<div id="problem">
<table id="incident">
<tr>
<td><input type="checkbox" value="value1"></td><td>value1</td>
<td><input type="checkbox" value="value2"></td><td>value2</td>
</tr>
</table>
</div>
...
<input type="text" value="" id="textfield_a01" maxlength="254"/>
What im trying to do, using JQuery & Greasemonkey, is to put each value from each checkbox that has been checked into the textfield. And if the checkbox get's unchecked, remove that value.
Right now, i have been working on something like this.
$(document).ready(function(){
function updateTextfield() {
var vals = [];
$('#incident :checked').each(function() {
vals.push($(this).val());
});
$('#textfield_a01').val(vals)
}
$(function() {
$('#incident input').click(updateTextfield);
updateTextfield();
});
});
But yes, it's not working, im thinking it might be because of the fact that checkboxes are inside a table, but im not quite sure. Any hints/recommendations on where to look is great, thanks in advance.