I am trying to add a class to a variable inside one of my if else statements in a jquery function. I am getting an error x.addclass is not a function. I have tried placing the variable in () and without. It makes no difference.
var ideal = document.getElementById( 'ideal_' + id )
var Search = document.getElementById('Search_' + id)
var parent = document.getElementById(+id)
if(ideal){
parent.addClass('myclass')
} else if (Search){
parent.style.background='yellow'
} else {
parent.style.background='none'
}