JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat.
Javascript is usually combined with HTML5 to implement rich UI. Below is useful information:
-
$.ajax({ async:true, url:url, success: function(v), error: function(xhr,status,err), timeout:3000}); (Knowledge Base) — The ajax() method is used to perform an AJAX (asynchronous HTTP) request. All jQuery AJAX methods use the ajax() method. This method is mostly used for requests where the other methods cannot be used.
-
$.get( url, function(data,status) {} ) (Knowledge Base) — $.get( url, function(data, status) {} ); is the straightforward and easy solution can download remote files or API response.
-
Adding HTML content dynamically by innerHTML (Knowledge Base) — When you assign ID for HTML entity for <p> tag or <div> tag, we can dynamically update its content. You can find the object by getElementById(), and do the necessary actions into innerHTML. For instance, you can do it like document.getElementById( "element_id").innerHTML = "hello, world!";
-
Array Length in JavaScript (Knowledge Base) — In JavaScript, <array>.length returns the total number of item.
-
Array.forEach( function(currentValue, index, arr) {} ); (Knowledge Base) — forEach() method calls a function for each element in an array.
-
Browser Memory Checking (Knowledge Base) — In JavaScript, you can't directly access the amount of memory consumed by your code or variables using a standard API. JavaScript does not provide a built-in method to check the memory consumption of objects or variables. However, you can make use of browser-specific tools and techniques to monitor memory usage for debugging purposes.
-
Change text color, font size and background color in textarea (Knowledge Base) — You can assign text color, font size, background color by style sheet in textarea
-
Check if the variable is object or not (Knowledge Base) — typeof <variable name> shows its type in string in JavaScript
-
Check whether a checkbox is checked in Javascript (Knowledge Base) — Checkbox object in HTML has a property checked as boolean - it has true or false, so javascript can check its status easily.
-
Close tabs in a browser that are associated with a specific domain like "foo.com" using JavaScript code (Knowledge Base) — You can close tabs in a browser that are associated with a specific domain like "foo.com" using the following JavaScript code
-
Combo box (drop-down list) in HTML (Knowledge Base) — To implement Combo box also known as drop-down list, you should use <select> tag
-
Count number of lines in the string in Javascript (Knowledge Base) — Counting number of lines in the string in Javascript is able to implement by regular expression.
-
Create empty array and add its elements in JavaScript (Knowledge Base) — You have two main ways to create empty array: const myArray=[] or const myArray = new Array();
-
Creating a beautiful table with CSS(style sheet) in HTML5 (Knowledge Base)
-
CSS cursor Property in HTML5 (Knowledge Base) — CSS can generate a bunch of different mouse cursors: