alert("The paragraph is now hidden");
});
});
what is thus?
The second parameter of removeClass must be a function that returns a class or classes to remove. Your alert() must be outside, so you can wrap all in a function, also I don't recommend targeting mutable elements like p:eq(1), it is a better practice to target element's class to prevent modification of other elements (like if you insert a new <p> at the beginning the target will change) You can wrap all in a function: $("p:eq(1)").on("click", function() { $(this).removeClass("blue"); alert("hidden?"); });
Обсуждают сегодня