Front End Technology Articles

Page 615 of 652

HTML for Attribute

AmitDiwan
AmitDiwan
Updated on 19-Sep-2019 215 Views

The HTML for attribute bounds the element to the first labelable element which has an id same as the value of for attribute.SyntaxFollowing is the syntax −1. Returning value of for attribute −labelObject.htmlForExampleLet us see an example of for attribute − Live Demo Label htmlFor    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;    } Label-htmlFor Current Editor: ...

Read More

HTML File Paths

AmitDiwan
AmitDiwan
Updated on 19-Sep-2019 420 Views

File path in a website is the location of a file in that website. This path might be relative (in reference to current path) or absolute (full URL of file).SyntaxFollowing is the syntax:1) Relative pathsrc="ImgFolder/picture.jpg"Orsrc="../ImgFolder/picture.jpg"Orsrc="/ImgFolder/picture.jpg"2) Absolute pathsrc="http://www.tutorialspoint.com/html5/foo.mp4"Let us see an example of HTML DOM Video src property−Example Live Demo HTML DOM Video src    * {       padding: 2px;       margin:5px;    }    form {       width:70%;       margin: 0 auto;       text-align: center;    }    input[type="button"] {       border-radius: 10px;    } ...

Read More

How to allocate memory in Javascript?

Ayush Gupta
Ayush Gupta
Updated on 19-Sep-2019 579 Views

Regardless of the programming language, memory life cycle is pretty much always the same −Allocate the memory you needUse the allocated memory (read, write)Release the allocated memory when it is not needed anymoreThe second part is explicit in all languages. Use of allocated memory needs to be done by the developer.The first and last parts are explicit in low-level languages like C but are mostly implicit in high-level languages like JavaScript.Hence there is no explicit way to allocate or free up memory in JavaScript. Just initializing objects allocates memory for them. When the variable goes out of scope, it is ...

Read More

Explain the event flow process in Javascript

Ayush Gupta
Ayush Gupta
Updated on 19-Sep-2019 876 Views

In the JavaScript, Event Flow process is completed by three concepts −Event Target − The actual DOM object on which the event occured.Event Bubbling − Explained belowEvent Capturing − Explained belowEvent bubbling is the order in which event handlers are called when one element is nested inside a second element, and both elements have registered a listener for the same event (a click, for example). With bubbling, the event is first captured and handled by the innermost element and then propagated to outer elements.With capturing, the event is first captured by the outermost element and propagated to the inner elements.Let's ...

Read More

How to create a custom object in JavaScript?

vanithasree
vanithasree
Updated on 19-Sep-2019 556 Views

To create a custom object in JavaScript, try the following codeExampleLive Demo                          var dept = new Object();          dept.employee = "Amit";          dept.department = "Technical";          dept.technology ="Java";          document.getElementById("test").innerHTML =          dept.employee + " is working on " + dept.technology + " technology.";          

Read More

How to use OR condition in a JavaScript IF statement?

Abhinanda Shri
Abhinanda Shri
Updated on 19-Sep-2019 5K+ Views

To use OR condition in JavaScript IF statement, use the || operator i.e Logical OR operator. If any of the two operands are non-zero, then the condition becomes true.Here’s how you can use the operator || in JavaScriptExampleLive Demo                    var a = true;          var b = false;          document.write("(a || b) => ");          result = (a || b);          document.write(result);          

Read More

How to convert a string to camel case in JavaScript?

Ayush Gupta
Ayush Gupta
Updated on 19-Sep-2019 1K+ Views

Camel case is the practice of writing phrases such that each word or abbreviation in the middle of the phrase begins with a capital letter, with no intervening spaces or punctuation. For example, Concurrent hash maps in camel case would be written as −ConcurrentHashMapsWe can implement a method to accept a string in JavaScript to convert it to camel case in the following way −Examplefunction camelize(str) {    // Split the string at all space characters    return str.split(' ')       // get rid of any extra spaces using trim       .map(a => a.trim())     ...

Read More

How to use JavaScript to hide a DIV when the user clicks outside of it?

Rishi Raj
Rishi Raj
Updated on 18-Sep-2019 1K+ Views

To hide a div when the user clicks outside of it, try to run the following codeExampleLive Demo                    window.onload = function(){             var hideMe = document.getElementById('hideMe');             document.onclick = function(e){                if(e.target.id !== 'hideMe'){                   hideMe.style.display = 'none';                }             };          };             Click outside this div and hide it.    

Read More

What is the difference between == and === in JavaScript?

Daniol Thomas
Daniol Thomas
Updated on 18-Sep-2019 997 Views

Double equals (==) is abstract equality comparison operator, which transforms the operands to the same type before making the comparison. For example,4    ==  4        // true '4'  ==  4        //true 4    == '4'       // true 0    == false     // trueTriple equals (===) are strict equality comparison operator, which returns false for different types and different content.For example,4 === 4  // true 4 === '4' // false var v1 = {'value':'key'}; var v2 = {'value': 'key'}; v1 === v2 //false

Read More

HTML <meter> max Attribute

AmitDiwan
AmitDiwan
Updated on 17-Sep-2019 156 Views

The max attribute of the element is used to set the upper bound for . However, the element is used to measure data with a give range like water impurity level and it is set using the min and max attribute.SyntaxFollowing is the syntax −The num above is a number in floating-point that sets the max attribute of the element.ExampleLet us now see an example to implement the max attribute of the element − Live Demo Water Levels Impurity Level TDS Level OutputThis will produce the following output −In the above example, ...

Read More
Showing 6141–6150 of 6,517 articles
« Prev 1 613 614 615 616 617 652 Next »
Advertisements