Side navigation
Ticket #1888: jquery_test.html
File jquery_test.html, 1.0 KB (added by davidserduke, December 10, 2007 06:09PM UTC)
test case
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Tester</title>
<style type="text/css">
#container { background:yellow; width:200px; }
</style>
<script type="text/javascript" src="../jquery.js"></script>
<script type="text/javascript">
$(function () {
$("button:first").click(function () {
var s1 = '<html><head><title>info</title></head><body><div>info</div></body></html>';
alert($(s1).find('div')); // [object Object]
var s2 = '<html>\n<head><title>info</title></head><body><div>info</div></body></html>';
alert($(s2).find('div')); // [error]
var s = "click!";
$("#adiv").text(s);
});
});
</script>
</head>
<body>
<button>Do It</button>
<div id="container">
Hi
</div>
<div id="adiv"></div>
</body>
</html>
Download in other formats:
Original Format
File jquery_test.html, 1.0 KB (added by davidserduke, December 10, 2007 06:09PM UTC)
test case
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Tester</title>
<style type="text/css">
#container { background:yellow; width:200px; }
</style>
<script type="text/javascript" src="../jquery.js"></script>
<script type="text/javascript">
$(function () {
$("button:first").click(function () {
var s1 = '<html><head><title>info</title></head><body><div>info</div></body></html>';
alert($(s1).find('div')); // [object Object]
var s2 = '<html>\n<head><title>info</title></head><body><div>info</div></body></html>';
alert($(s2).find('div')); // [error]
var s = "click!";
$("#adiv").text(s);
});
});
</script>
</head>
<body>
<button>Do It</button>
<div id="container">
Hi
</div>
<div id="adiv"></div>
</body>
</html>