DDan DDan - 8 months ago 38
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/