User Tools

Site Tools


jquery:allgemein

This is an old revision of the document!


jQuery

eigene Selektoren erstellen wie hier

<html>
<head>
<title>jQuery Custom Selector Test</title>
<script type="text/javascript" src="jquery-latest.pack.js"></script>
<script type="text/javascript">

## Extend the jQuery object to include the
## custom selector "hottie" for the ":" expression.
		jQuery.extend(
			jQuery.expr[ ":" ],
			{
				hottie : (
					"jQuery( a ).attr( 'rel' ) == 'girl' && " +
					"jQuery( a ).attr( 'hotness' ) >= 9"
  					)
  			}
    			);
 
 
// This will highlight the girls who are hotties.
		function FindHotties(){
 
			$( "ol a:hottie" ).css( "font-weight", "bold" );

		}
 
	</script>
</head>
<body>
 
	<ol>
 		<li><a rel="girl" hotness="9.0">Sarah</a></li>
		<li><a rel="girl" hotness="8.0">Libby</a></li>
		<li><a rel="girl" hotness="9.0">Azure</a></li>
		<li><a rel="girl" hotness="8.5">Cindy</a></li>
	</ol>
 
	<p>
		<a href="javascript:void(0);"
			onclick="FindHotties();"
			>Find Hotties</a>
</p>
 
</body>
</html>
jquery/allgemein.1338584547.txt.gz ยท Last modified: (external edit)