[HTML] Highlight row when click on table using jquery


description
        - Create table grid with active color (highlight) when clicked a row using javascript (jquery).

howto
1. download jquery.
2. create index.html , css folder(inside the folder create style.css)
    and js folder (inside the folder put jquery file).
3. here's the code :
     - declare js and css.
        <script type="text/javascript" src="js/jquery-1.10.2.js"></script>
        <script type="text/javascript" src="js/jquery-ui-1.10.4.custom.min.js"></script>
        <script type="text/javascript" src="js/jquery-ui-1.10.4.custom.js"></script>
        <link rel="stylesheet" type="text/css" href="css/jquery-ui-1.10.4.custom.css">
        <link rel="stylesheet" type="text/css" href="css/style.css">
 
     - create simple table grid :
       * for row table , give id for example #rowtable
       <table>
            <tr>
                 <th>row 1 , cell 1 , this is header 1</td>
                 <th>row 1 , cell 2 , this is header 2</td>
            </tr>
            <tr id="rowtable">
                 <td>row 2 , cell 1 , this is values 1</td>
                 <td>row 2 , cell 1 , this is values 2</td>
            </tr>
            <tr id="rowtable">
                 <td>row 3 , cell 1 , this is values 1</td>
                 <td>row 3,  cell 1 , this is values 2</td>
            </tr>
       </table>

      - add css code to your style.css
        tr{ /* make sure change cursor when over row , it looks like profesional LOL */
            cursor: pointer;
            cursor: hand;
        }

        #rowtable:hover{
            background:orange !important;
        }

        #rowtable.clicked{ /*it means id='rowtable' class='clicked'*/
            background:orange;
        }

      - now add javascript code using jquery
        $("document").ready(function(){
             $('tr').click(function() {
                      $(this).removeClass("clicked")
                      $(this).addClass("clicked").siblings().removeClass("clicked");
             });
        });

4. DONE , now you can highlight the row when click , and it's automatic remove highlight
    when change to another row :)
     

[HTML] CSS dan Javascript


Deskripsi
     Untuk tutorial lebih lengkap bisa dilihat di w3schools.com , tapi kali ini saya hanya menyediakan link copy paste di html untuk linking ke file external source, males ngingetnya bro haha :D

Copas Here :

CSS external :
<link rel="stylesheet" type="text/css" href="mystyle.css">

JS external :
<script src="myScript.js"></script>

*kaburrrrrrr

[HTML][CSS] Different Position Relative and Float Left or Right


Deskripsi
     Untuk mengetahui perbedaan antara Position relative dengan Float left atau right, sebelumnya kita harus mengetahui konsep dari div itu sendiri.      

Howto
     Div Concept :
* Text or Image is the content of the Div , so to change appearance just add CSS style on div
* Padding is space between text/image and div line
* Margin is space between div line with margin line (not exist just conceptual)
* Position is space between margin line (not exist just conceptual) with outer line (not exist just conceptual)

so the case is what's the different ??

* Position Relative, the div element still intact with the Html Element, and i consider the 'position space' use a maximum width (whatever you change width the div, 'position space' still use maximum width) , that's why no another element beside the div and the element shifted down with another element which same element property.

* Float left / right, the div element still intact with the Html Element, BUT it remove 'Position Space' so the outer line is margin line (does not exist just conceptual), and the div fill the empty space to the top but it adjust with the current width and the element shifted left or right with another element which same element property.

what about absolute ? absolute same as float remove 'position space' but the element NOT intact with the Html Element and another element , so it can stack with the same div which use the same position.

hope's this help !!