| Version 7 (modified by amachang, 6 years ago) |
|---|
XPath for jQuery
XPath for jQuery is JavaScript-XPath binding for jQuery.
Release/Download
- Latest Version
- If you can use subversion, check out the trunk with:
svn co http://svn.coderepos.org/share/lang/javascript/javascript-xpath/bindings/jquery/ x4j
Requires
- jQuery JavaScript file.
- JavaScript-XPath JavaScript file.
How to use
- Import jQuery JavaScript file.
- Import JavaScript-XPath JavaScript file (this js file does nothing for browsers which support DOM 3 XPath natively).
- Import XPath for jQuery JavaScript file.
- Enjoy with XPath!
Simple Example
<html>
<head><title>Hello, XPath!</title>
<!-- import jQuery -->
<script type="text/javascript" src="jquery.js"></script>
<!-- import JavaScript-XPath -->
<script type="text/javascript" src="javascript-xpath.js"></script>
<!-- import XPath for jQuery -->
<script type="text/javascript" src="xpath4jquery.js"></script>
<!-- use XPath -->
<script type="text/javascript">
// <![CDATA[
$(function() {
$('//ul')
.xfind('li[1]')
.append('Shut up')
.end()
.xfind('li[2]')
.append('and')
.end()
.xfind('li[3]')
.append('commit')
.end()
.xfind('li[4]')
.append('some code')
.end()
})
// ]]>
</script>
</head>
<body>
<h1>Hello, DOM 3 XPath!</h1>
<ul>
<li>1. </li>
<li>2. </li>
<li>3. </li>
<li>4. </li>
</ul>
</body>
</html>
Supported Browser
- IE 6+
- Safari 2+
- Firefox 1+
- Opera 9+
Demo
- Coming soon.
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)