1

This solution is currently working as intented but is there a "prettier" way to do this? :)

if (EditCheckLog()) {
    var chk = $(this).prop('checked');
    chk = !chk;
    $(this).prop('checked', chk);
    return;
}
8
  • Yes, this.checked =! this.checked. But this question is suittable for stackoverflow, it should be on CodeReview. Commented Feb 12, 2015 at 20:56
  • Aha did not know about CodeReview. Thanks! Commented Feb 12, 2015 at 20:57
  • 2
    I'm voting to close this question as off-topic because this belongs to Code review Commented Feb 12, 2015 at 20:57
  • @Huangism Was searching the close reason... don't understand why "other stack network" doesn't have code review.... Commented Feb 12, 2015 at 20:58
  • @Karl-AndréGagnon strange indeed, perhaps this should be brought up in Meta Commented Feb 12, 2015 at 21:01

1 Answer 1

3

You don't need to use jQuery. Here is a simple approach:

if (EditCheckLog()) {
    this.checked = !this.checked;
    return;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.