Ordering the Javascript Array

Javascript, 2016-05-30 06:53:19 UTC
1. Ordering an array; var arrA = [10,2,4,5,0,3,4]; arrA.sort(); // [0, 10, 2, 3, 4, 4, 5]   2. Ordering a simple array with a function; var arrA = [10,2,4,5,0,3,4]; // 1arrA.sort(function(a, b){     return a - b; }); // 1 result // [0, 2, 3, 4, 4, 5, 10]   // 2arr
Share:     

How to upload file using Ajax and Rails

Javascript, jQuery, Ruby, Ruby on Rails, 2016-02-12 10:58:00 UTC
In this case, we need a plugin    <form id="the_form" action="/page/gambars/form_upload" method="post" enctype="multipart/form-data"> <div> File<br /> <input name="gambar[gambar_name]" /> </div> <div> <button type="submi
Share:     

An easy way using webpack

Javascript, Utilities, Web Development, 2016-01-14 11:07:36 UTC
1. Install webpack  $ npm install webpack -g   2. Create index.html <html>     <head>         <meta charset="utf-8">     </head>     <body>         <script type="text/javascript"
Share:     

How to know the browser tab is active or not

Javascript, Web Development, 2016-01-13 12:04:54 UTC
Today I am dealing with case when the tab is active, music is playing and if not music is pause.  To solve this problem, I need an even listener. Here is the code; var hidden, visibilityChange; if (typeof document.hidden !== "undefined") { hidden = "hidden"; visibilityChange = "vis
Share:     

JavaScript Reserved Words

Javascript, 2015-06-17 00:09:41 UTC
  abstract arguments boolean break byte case catch char class* const continue debugger default delete do double else enum* eval export* extends* false final finally float for function goto if implements import* in instanceof int in
Share:     

Single page application using jQuery

Javascript, jQuery, 2015-06-17 00:06:39 UTC
Sometimes you see the URL format like this; http://example.com/#!/the_page. Usually, this is the Angular application. This is good technique to load the page faster than a standard technique. In this tutorial, I want to show you how to create it and this technique is just using jQuery. Let's take a
Share:     

Lazy load technique with just 'three lines' of code

Javascript, 2015-06-17 00:05:10 UTC
In my opinion, lazyload is another way of pagination. The concept of lazyload is loading the data as the request. The easiest way to implement lazy load is by requesting the data when the user scrolling the page down. For this concept, the data is ajax page which I wrote before. This is how to mak
Share:     

DOM manipulating with JavaScript

Javascript, 2015-06-16 23:12:42 UTC
Scripting language usually used for small applications. At the present time, scripting language has evolved become enterprise applications. In the past, JavaScript has widely used to control the HTML page. But, today, JavaScript evolved widely as game engine, animation page, UI framework and so on. In this post, I will show you how to manipulate HTML DOM using JavaScript by exercise; 1. Adding an DOM node <!DOCTYPE html> <html> <head> <title>Example 1</title> </head> <body> <div id="ele01"></div> <script> document.getElementById('ele01').innerHTML = "Hi, this is an alement"; </script> </body> </html> If we run the script, we will see "Hi, this is an alement" exactly in div#ele01 box.
Share: