This is very generic, so you'll have to be more specific with your
selectors, but it should give you an idea of how to do this:
$(document).ready(function() {
$('input:checkbox').click(function() {
if ($(this).is(':checked')) {
$('input:text').val('').attr('disabled', true);
} else {
$('input:text').attr('disabled', false);
}
});
});
--Karl
____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Sep 1, 2008, at 6:31 AM, Robert Rawlins wrote:
Good afternoon guys,
I’m pretty much a jQuery novice and I’m looking for your advice on
how to achieve this task. I have two input fields which I want to be
disabled by default, with a checkbox which is checked. Then, if a
user unchecks the checkbox it will enable the two fields for them to
enter data in.
In addition to this, if they enter information into the two fields
and then recheck the box, I would like it to clear any values they
entered and disable them again.
Can anyone offer any pointers or code for this?
Many thanks guys,
Robert