Opened 14 years ago
Closed 13 years ago
#4815 closed bug (invalid)
Doesn't add a class properly
Reported by: | mnsanthoshkumar | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.4 |
Component: | unfiled | Version: | 1.3.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
There are 2 cells in a table and 1 has a class defined. I was trying to transfer the class to the other cell with the below code, but it didnt help.
<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 StrictEN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>jQuery</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script> <script type="text/javascript">
$(function() {
$('#up > td').next().addClass('test').end().removeClass('test');
}); </script>
<style> .test {
border:12px red solid;
} </style> </head> <body id="body" class="body">
<table width="100%" border="1">
<tr id="up">
<td class="test">1</td> <td>2</td>
</tr>
</table>
</body>
</html>
Your selector is selecting all tds under #up. Please review the jQuery docs and ask questions on the forums.