JavaScript Tutorial/jQuery/next
Get next tag
<source lang="javascript">
<html>
<head> <script type="text/javascript" src="js/jquery-1.3.2.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("input[name="me"]").next().text(" changed");
}); </script> </head> <body>
<input type="radio" name="me" value="A" />
data
<input type="radio" name="me" value="B" />
data
<input type="radio" name="me" value="C" />
data
</body>
</html></source>
Get next tag from selected one
<source lang="javascript">
<html>
<head> <script type="text/javascript" src="js/jquery-1.3.2.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("button[disabled]").next().text("data");
}); </script> <style> .y { background:yellow; } </style> </head> <body> <body>
<button disabled="disabled">First</button> -
</body>
</html></source>
Next class
<source lang="javascript">
<html>
<head> <script type="text/javascript" src="js/jquery-1.3.2.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("button[disabled]").next(".selected").text("data");
}); </script> <style> .y { background:yellow; } </style> </head> <body> <body>
<button disabled="disabled">First</button> -
</body>
</html></source>
next(expr)
<source lang="javascript">
<html>
<head> <script type="text/javascript" src="js/jquery-1.3.2.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("p").next().text("asdf"); }); </script> </head> <body> <body>
bad or .
good</body>
</html></source>