> It sounds like you're trying to avoid the multiple $("a.item:contains(key)") > calls, is that right? Those aren't working right as you have it now anyway, > because you're testing for the literal string "key", not the value of the > key. I think you mean $('a.item:contains('+key+')').
Yeah, sorry, that was a syntax error in my example that isn't present in the actual script. > Also, do you care if the doStuff() happens before the getJSON request is > made, or can it be done after getJSON responds with the data? doStuff() can occur before or after getJSON, doesn't matter. > And what about the :contains bit? Can the key actually be any substring of > the anchor text, or would it work to test the entire anchor text string? > That is, given this A tag: > > <a href="...">foo bar</a> > > Do you need to be able to match on either 'foo' or 'bar', or do you just > need to be able to match 'foo bar'? If the latter, there is a simple and > fast solution. Let me know and I'll post it. I need to match the entire string, portions of it. So, 'foo bar' needs to be matched. > Finally, I assume you mean a JSON *object*, not an array, correct? Yeah, an object. Sorry, I haven't used much JS and I'm not familiar the terms for everything. I just know I interact with the data in this instance as you would an array. I understand an object is much more than that. =p Thank you greatly for your help.