If I have an editable checkbox defined in a table as follows:

<ctrl:columncheckbox title="Delete" 
                     property="delete" 
                     styleId="delete" 
                     editable="true" 
                     onchange="setFlag();"/>

How would I go about passing the value of the checkbox to a boolean that I've defined in javascript? I.e. what should the "setFlag()" function look like?

Thank you for any help in advance.

有帮助吗?

解决方案

It looks like you're using some server-side control to render the checkbox. In most cases, you would look up whether or not a checkbox is checked using its id attribute, which does not appear to be specified in the code you provided. Look at the actual HTML that is rendered. It should look something like this: <input type='checkbox' id='foo' />. Your Javascript might look something like this.

var isChecked = document.getElementById('foo').checked

If you are talking about a whole column of checkboxes, as your code suggests, you might want to look into something like jQuery that has a rich API for looking up various elements on the page.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top