0

I was trying to figure out if it was possible to pass in a js array as the selector and then program with it.

Similarly, I wanted to know if i got the return from a function (in the format of a XML doc) and put it into the jQuery selector, would i be able to parse it.

4

1 回答 1

0

我对其进行了测试,只要 JS 数组是 HTML 元素(在我的例子中是 Divs),它就可以正常工作。在引用方面略有不同。前任:

 $(SELECTED).closest(".draggable").css("background-color","pink");

现在会变成:

 $(SELECTED).each(function(){
   $(this).closest("draggable").css("background-color","pink");
 });
于 2012-06-28T16:00:04.733 回答