.css() is not a function [jQuery]?

When you use like elem[curIndex], the elem (jQuery wrapper) becomes javascript object. So, you're getting such error as they are not of core javascript method but jquery.

So, you need to wrap it again with jquery:

$(elem[curIndex])//now using .css() or .attr() will not throw you errors.

Use $(elem[curIndex]) instead of elem[curIndex] and Try this:

.css() is method of jquery and if you want to use that method you can access element using

So it will be:

$(elem[curIndex]).css("border-color", "yellow");

Now if you want to use javascript to add style to element you can try this:

(just an example)

var myElement = document.querySelector("#superman");
myElement.style.backgroundColor = "#D93600";