Checked attribute is always true

Checked attribute is always true

Am using several check boxes in my application.I have an event handler associated with its click event.There when i access the checked attribute, it returns the right value while running the application.

  1. $('#checkBoxID').attr(checked_, $(this).is(':checked'));
  2. alert($('#checkBoxID').attr(checked_)); //Returns true when checked and false when unchecked

But it always returns true while Q unit test cases are executed.Why is this? Both cases the handler is invoked by the click event of the handler only...

  1. $('#checkBoxID').attr(checked_, $(this).is(':checked'));
  2. alert($('#checkBoxID').attr(checked_)); //Returns true always.The control is directed from the simulated click from Qunit testing 
//Both code snippets are from the same handler.Execution contexts alone differ.

It would be great if somebody can help me on this.

Thanks in advance.

Ramesh