Hi Paolo, Thanks, but no luck.. I replaced
if( jQuery('#no_table_cnd').attr('checked') ); with if( jQuery('#no_table_cnd').prop('checked') ); ..but the box is still displayed by default & doesn't change when I check/uncheck the checkbox.. Cheers, -j On Thu, Jul 25, 2013 at 12:39 PM, Paolo Caruccio <paolo.carucci...@gmail.com > wrote: > Maybe related with > https://groups.google.com/d/msg/web2py/om58tz-DVOk/Lt5beXcLiH8J > > By resuming the api: > > *As of jQuery 1.6*, the .prop() method provides a way to explicitly >> retrieve property values, while .attr() retrieves attributes. > > > Therefore, you should replace .attr() with .prop() if you are using a > recent version of jQuery > > > > Il giorno giovedì 25 luglio 2013 21:05:36 UTC+2, Jordan Ladora ha scritto: >> >> Hi, >> >> I'm still stuck here.. I tried a few other things. I just want to >> show/hide #nnd based on whether or not #cnd is checked. This example is in >> the manual, but I still cannot get it to work.. >> >> Here's the form- >> >> fields = [] >> fields.append( Field( 'cnd', 'boolean', default=True) ) >> fields.append( Field( 'nnd') ) >> >> form = SQLFORM.factory(*fields) >> >> >> And the view- >> >> <script> >> >> jQuery(document).ready(**function() >> { >> jQuery('#no_table_nnd__row').**hide(); >> jQuery('#no_table_cnd').**change(function(){ >> if( jQuery('#no_table_cnd').attr('**checked') ); >> jQuery('#no_table_nnd__row').**show(); >> else >> jQuery('#no_table_nnd__row').**hide();}); >> }); >> >> </script> >> >> >> But still the input box stays visible regardless of the status of the >> checkbox.. :( Any help would be greatly appreciated. >> >> Thanks, >> -j >> >> >> On Fri, Jun 21, 2013 at 2:07 PM, Jordan Ladora <vicepres...@gmail.com>wrote: >> >>> Hi, >>> >>> I have a jQuery script in a view. It has a bug as it's not working >>> (textbox always shown). I think my syntax in the if statement is wrong.. >>> here it is- >>> >>> <script> >>> >>> jQuery(document).ready( >>> function() >>> { >>> if( jQuery('#cnd').prop('checked', true) ); >>> { >>> jQuery('#nnd').show(); >>> } >>> else >>> { >>> jQuery('#nnd').hide(); >>> } >>> >>> } >>> ); >>> >>> </script> >>> >>> >>> The element with id #cnd is a checkbox, and the element #nnd is a >>> textbox. Putting a single line inside the doc ready function, eg >>> >>> jQuery('#nnd').show(); >>> >>> hides or shows the box just fine. >>> >>> Thanks for any help!!! >>> >>> >>> -jl >>> >>> -- >>> >>> --- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "web2py-users" group. >>> To unsubscribe from this topic, visit https://groups.google.com/d/** >>> topic/web2py/EqxNV-LO7oY/**unsubscribe<https://groups.google.com/d/topic/web2py/EqxNV-LO7oY/unsubscribe> >>> . >>> To unsubscribe from this group and all its topics, send an email to >>> web2py+un...@**googlegroups.com. >>> >>> For more options, visit >>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>> . >>> >>> >>> >> >> -- > > --- > You received this message because you are subscribed to a topic in the > Google Groups "web2py-users" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/web2py/EqxNV-LO7oY/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > web2py+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.