Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <table id="waypointsTable" border="1">
- <tbody>
- <tr>
- <td>some text</td>
- </tr> ...
- $('#waypointsTable > tbody > tr > td').hover(function() {
- alert(1);
- }, function() {
- alert(2);
- });
- $('#waypointsTable tr').hover(function() {
- $(this).addClass('hover');
- }, function() {
- $(this).removeClass('hover');
- });
- #waypointsTable tr:hover {
- background-color:yellow;
- }
- <script type="text/javascript">
- $("tr").not(':first').hover(
- function () {
- $(this).css("background","yellow");
- },
- function () {
- $(this).css("background","");
- }
- );
- </script>
- tr td { background: normal background style here }
- tr:hover td { background: hovered background style here}
- $("#waypointsTable tr").not(':first').hover(function(){
- $(this).addClass("tr-hover");
- },function(){
- $(this).removeClass("tr-hover");
- }
- );
- $("#table_id").on("mouseover", 'tr' function () {
- //stuff to do on mouseover
- });
- $('#waypointsTable tr').hover(function() {
- $(this).toggleClass('hover');
- });
- .hover {
- background-color:green;
- }
- $(function () {
- $("tr:not(:has(th))").mouseover(function () {
- $(this).addClass("hover");
- });
- $("tr:not(:has(th))").mouseleave(function () {
- $(this).removeClass("hover");
- });
- });
- .hover
- {
- background-color: #81B441;
- }
- <table class="tblBorder" border='1'>
- <tr class="hover"><th>No</th><th>Page Name</th><th>No of View</th><th>Comments</th></tr>
- <tr><td>1</td><td>Java Script</td><td>28</td><td>10</td></tr>
- <tr><td>2</td><td>CSS</td><td>29</td><td>78</td></tr>
- </table>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement