Getting the values in a list
I'm writing some code to work out if a value is in a list. The list is populated by a REST query to the database.
I'm using a jquery selector on the class of the label within each list item. Then iterating the innerHTML to get the value. The code is:
$('.label').each(function (){
if (this.innerHTML == newCategory) categoryExists = true;
});
I can't help feeling that this is a clumsy way of doing it. Is there a simpler way of obtaining the values in a list?