Hello david,
Thank you for your reply.
I've changed the if statement to .atrr('checked') like you mentioned.
I am having one problem though, when I click the box, it changes its
status back to default after executing the js. For example, I have an
alert within the if statement.. when I check it for example, it stays
checked just until I click ok on the alert then it goes back to
unchecked. Have any idea on what is happening?
On Jan 18, 11:59 am, david <[email protected]> wrote:
> I am giving you general pointers to functions:
> use the bind function to registrar the checkbox for the onchange event
> in the callback function check if the checkbox is checked through the
> attr( 'checked' ) function
>
> by the way i think the value of disabled is "disabled"
>
> Good Luck,
> David
>
> On Jan 18, 3:32 pm, Toaster <[email protected]> wrote:
>
> > Hey
>
> > I was wondering on how I might be able to have a checkbox that when
> > checked or unchecked would disable or enable a dropdown.
>
> > I am still very new to jQuery but this is what I have but doesnt work.
>
> > ----------------------------------------------------------------------------
> > function stillWork(id) {
> > if ($(id).is(':checked'))
> > {
> > $("#work_month_end_1").attr("disabled", true);
> > $("#work_year_end_1").attr("disabled", true);
> > }
> > if ($(id).not(':checked'))
> > {
> > $("#work_month_end_1").removeAttr("disabled");
> > $("#work_year_end_1").removeAttr("disabled");
> > }
> > }
> > ----------------------------------------------------------------------------
>
> > I also experimented with a couple other ways and it usually gives me a
> > problem where it automatically unchecks a box after checking it/
> > running the js.
>
> > Thanks in advance