DDan DDan - 2 months ago 4
Javascript Question

HTML class not removed

See my example here: https://jsfiddle.net/ddan/xvq6ofhh/


$(function() {
var listEditPane = $('#editpane');

console.log($(listEditPane).find('.input-highlight').length); // 2
console.log($(listEditPane).find('.input-highlight').length); // still 2 ???

The class is not removed, the length is still staying the same. What am I missing?



The .removeClass() method expects the name(s) of the class(es) to remove, but you are passing a selector '.input-highlight'. Remove the . from the beginning:


Demo: https://jsfiddle.net/xvq6ofhh/1/