first() next() last()
first() next() last()
hi, every body. help me
why my this code not run????
<html>
<head>
<style>
.box{
background-color : gray ;
height : 200px ;
width : 500px ;
}
</style>
<script src="js/jquery-latest.js"></script>
<script language="javascript">
$(document).ready(function(){
$("#btn1").bind('click',function(){
var $p1=$("#div1 div").first();
$p1.css('color','yellow');
var $p2=$("#div1 div").last();
while($p1 != $p2){
$p1=$p1.nextAll();
$p1.css('color','yellow');
}
});
});
</script>
</head>
<body>
<div id="div1" class="box">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
</div>
<button id="btn1">test</button>
</body>
</html>