Radio / flag detection "checked" in jquery user interface. Basic buttons are not updated

I am using a jQuery UI button widget in a form that I need to check for some radio / checkbox elements.

According to the demo in the provided link -

Their (source elements) associated label is like a button, while the main input is updated by click.

if you check even the page with examples on which I pointed out that the main elements of the buttons are not updated with anything. Note - The middle switch in this example is set by default.

I use the following code to detect button states - oddly enough, this is always true (it appears that this will be a lie).

 $el = $("#someCheckbox"); if($el.attr('checked')){ //do stuff } 

It looks like I can get the button state from the jquery ui shortcut as the button style (a la class="ui-state-active) , but I would like to avoid reading labels and stick to checking the correct switches.


Am I looking for form data incorrectly by accessing the original switch?

OR

Is this a potential bug in jquery ui butotn widget?

+6
javascript jquery jquery-ui jquery-ui-button
source share
1 answer

Just looked at the demo pages on jqueryui.com. Everything seems to be working fine. However, let jQuery decide if the input is verified. Try

 $el = $("#someCheckbox"); if( $el.is(':checked') ){ //do stuff } 

Hope this helps.

+9
source share

All Articles