Ticket #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: | ||
| Blocking: | Blocked by: |
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>
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Your selector is selecting all tds under #up. Please review the jQuery docs and ask questions on the forums.