I want to change src of icon used in SharePoint search template.
But error is coming that .attr is not a function. Am I missing something here?
If it returns an object then you can use any functions of that object.
There might be 2 reasons for your issue
Try to execute with following syntax to get additional information
jQuery(".cbs-ItemLink img") jQuery(".cbs-ItemLink img").attr("src","/")
When jQuery says something (on an object) is not a function, the object itself (your DOM element in this case) is not there
With SP Search, the results HTML is coming in async, so you can't query for something that is not in the DOM yet
window.setTimeoutfunction to delay execution of your code and every cycle check if your required DOM element exists