79112861

Date: 2024-10-22 07:25:45
Score: 0.5
Natty:
Report link

this code returns only the DOM element, not the jquery object

$(".btn")[0].toggleClass("pressed");

but if you want to toggle the class on the first specific button you should use this:

$($(".btn")[0]).toggleClass("pressed");
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: kvz