$('a').click(function(){$('input[name=' + this.id+ ']').val(!$ ('input[name=' + this.id+ ']').val())});//
On Aug 21, 7:02 am, "Andy Matthews" <[EMAIL PROTECTED]> wrote: > I'm storing a boolean in a hidden field, and I'd like to flip it's value > when someone clicks a link. Here's the function I've got currently: > > function toggleInput($el) { > // get the ID of the element being passed in > var id = $el.attr('id'); > // get form element > var $formEl = $('input[name=' + id + ']'); > // get the current value of the selected form field > var value = $formEl.val(); > // set the new value > $formEl.val(!value); > alert(value); > > } > > I seem to recall a way to invert the value in one line, but it's eluding me > at this time. Can someone help me out? > > ____________________________________ > > Andy Matthews > Senior ColdFusion Developer > > Office: 615.627.9747 > Fax: 615.467.6249www.dealerskins.com<http://www.dealerskins.com/> > > Total customer satisfaction is my number 1 priority! If you are not > completely satisfied with the service I have provided, please let me know > right away so I can correct the problem, or notify my manager Aaron West at > [EMAIL PROTECTED] > > 2008 Email NADA.jpg > 17KViewDownload