Home:ALL Converter>what does this function do and what does it mean ?`

what does this function do and what does it mean ?`

Ask Time:2016-05-27T04:33:21         Author:luly

Json Formatter

I'm trying to understand what each line of this code does e.g. why is the $ there and what does it do?, can anyone help?

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<head> 
<script>
i=1;
$(document).ready(function(){
    $("button").click(function(){

    if(i==1){   
    document.getElementById("tf1").setAttribute("fill", "transparent");
    document.getElementById("tf2") .setAttribute("fill", "yellow");
        i=2;
     }else if (i==2){
    document.getElementById("tf2").setAttribute("fill", "transparent");
    document.getElementById("tf3") .setAttribute("fill", "green");
    i=3;
      } else if(i==3) {
    document.getElementById("tf3").setAttribute("fill", "transparent");
    document.getElementById("tf1").setAttribute("fill", "red") ;
        i=1;
    }       

    });
});

</script>

Author:luly,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/37470466/what-does-this-function-do-and-what-does-it-mean
yy