[Solved] Match str to selector


Assuming getTerm is working correctly in the mixed js php paradigm. You should be able to find the element like so:

// instead of "Itemtwo" or "Item-two" 
// lets make it match exactly as in "Item two"
getTerm = getTerm.replace('-',' '); 

$('#itemList li').each(function() {
    var that = $(this);
    if (getTerm  == that.text()) {
        that.css('color','red'); // for example
    }
});

1

solved Match str to selector