1 | <!DOCTYPE html> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | <title></title> |
---|
5 | <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js" type="text/javascript"></script> |
---|
6 | <script type="text/javascript"> |
---|
7 | $(function(){ |
---|
8 | |
---|
9 | var x = $("#test").add("#chooser"); |
---|
10 | |
---|
11 | alert("add selector: "+ (x.length==2? "pass" : "fail")); |
---|
12 | |
---|
13 | var y = $("#test").add(document.getElementById("chooser")); |
---|
14 | |
---|
15 | alert("add DOMElement: "+ (y.length==2? "pass" : "fail")); |
---|
16 | |
---|
17 | }); |
---|
18 | </script> |
---|
19 | </head> |
---|
20 | <body> |
---|
21 | |
---|
22 | <div id="test"> this is all there is to see </div> |
---|
23 | <select id="chooser"> |
---|
24 | <option> unless </option> |
---|
25 | <option> there is </option> |
---|
26 | <option> a bug </option> |
---|
27 | </select> |
---|
28 | |
---|
29 | </body> |
---|
30 | </html> |
---|