-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdom_traversing_next.php
More file actions
39 lines (32 loc) · 994 Bytes
/
dom_traversing_next.php
File metadata and controls
39 lines (32 loc) · 994 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
?>
<!DOCTYPE html>
<html>
<head>
<style>
span { color:blue; font-weight:bold; }
button { width:100px; }
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script language="javascript">
$(function () {
$("button[disabled]").nextAll().text("this button is disabled");
//alert($("button[disabled]").parent().nextAll().length);
if($("button[disabled]").parent().nextAll().length == 0) {
$('#news ul li:first-child').addClass('active');
}else {
$("button[disabled]").parent().next().addClass('active');
}
});
</script>
</head>
<body>
<div><button disabled="disabled">First</button> - <span></span></div>
<div><button>Second</button> - <span></span></div>
<div><button disabled="disabled">Third</button> - <span></span></div>
</body>
</html>