JQUERY Programming Language was released in 2006 by John Resig, the use of JQUERY for Website programs is growing rapidly, for example Google, BBC, Facebook, Amazon, Youtube, Detikcom and many more. So the use of the JQUERY Programming Language is very familiar to web developers.
The JQUERY Programming Language is a collection of functions contained in the javascript library that are ready to use, making it easier and faster for us to create javascript code. If we create a javascript function to create a stripe (alternating colors) on the rows of a table, it will require complex and lengthy code as follows:
function stripe(id) {
var even = false;
var evenColor = arguments[1] ? arguments[1] : “#fff”;
var oddColor = arguments[2] ? arguments[2] : “#eee”;
var table = document.getElementById(id);
if(! table) { return; }
var tbodies = table.getElementByTagName(“tbody”);
for (var h = 0; h < tbodies.length; h++) {
var trs = tbodies[h].getElementByTagName(“tr”);
for (var i = 0; i < trs.length; i++) {
if(! hasClass(trs[i]) && ! trs[i].style.backgroundColor) {
var tds = trs[i].getElementByTagName(“td”);
for(var j = 0; j<tds.length; j++) {
var mytd = tds[j];
if(! hasClass(mytd) && ! mytd.style.backgroundColor) {
mytd.style.backgroundColor = even ? evenColor : oddColor;
}
}
}
}
}
}
JQUERY Programming Language as a javascript library can directly call functions as needed by the developer. Interestingly, we only need one/two rows to create a stripe of colors in a table, namely:
JQUERY Programming Language(‘table tr:nth-child(odd)’).addClass(‘odd’);
It can be concluded that the JQUERY Programming Language simplifies the use of scripts in javascript. As per jQuery’s slogan “Write less, do more”, just write a little but can do a lot.
Before learning the JQUERY Programming Language, we should already know:
Faculty of Engineering and Computer Science
More Click Here
In using the JQUERY Programming Language, here are some reasons that prove the JQUERY Programming Language is worthy of being an option in creating interactive websites
The JQUERY Programming Language will describe the capabilities possessed by jQuery including:
It usually requires a fairly long line of program to access an element of the document. But jQuery can do it in just a few lines of program, because jQuery has a very efficient selector to access a certain element in the document which can then be manipulated according to our wishes.
Usually, CSS is used to modify the appearance of web pages, the problem is that CSS is strongly influenced by the web browser used, so it often happens that web pages that are created are neat and look good on the Mozilla browser but when displayed in the Opera browser it becomes messy, but jQuery can adjust the CSS style on all browser, so that these problems can be avoided.
The ability of Ajax is able to retrieve information from the server without having to refresh the web page, meaning that the visible web page can change automatically. If we use Ajax requires a long line of script, but jQuery can shorten it by using an Ajax call.
JQUERY Programming Language requires Three main steps
<html>
<head>
<script type=”text/javascript” src=”jquery-1.8.0.min.js”>
</script>
<script type=”text/javascript”>
$(document).ready(function(){
$(“.sembunyi”).click(function(){
$(“#foto”).hide(“slow”);
});
$(“.tampil”).click(function(){
$(“#foto”).show(“normal”);
});
});
</script>
</head>
<body>
<button class=”sembunyi”>Sembunyikan</button>
<button class=”tampil”>Tampilkan</button>
<p><img id=”foto” src=”Masjid.jpg”></p>
</body>
</html>
From the script above, it can be explained how the JQUERY Programming Language works as follows:
$(document).ready(function(){
// jQuery line of code will be executed
// when all elements are displayed
});
$(“#foto”)
$(“.sembunyi”)
$(“.tampil”)
$(“.sembunyi”).click(function(){
$(“#foto”).hide(“slow”);
});