
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 8591 Articles for Front End Technology

130 Views
To fix this, use the concept of this keyword. User another variable to hold the value of object, to use that inside the inner function.ExampleFollowing is the code −function Employee() { this.technologyName = "JavaScript"; var currentTechnologyName = this; function workingTechnology() { console.log("I am working with " + currentTechnologyName.technologyName + " Technology"); } workingTechnology(); } var currentTechnology = new Employee();To run the above program, you need to use the following command −node fileName.js.Here, my file name is demo216.js.The output is as follows −PS C:\Users\Amit\JavaScript-code> node demo216.js I am working with JavaScript Technology

129 Views
To display variables on console, use document.getElementById(“”).ExampleFollowing is the code − Live Demo Document const data = document.getElementById("printTheData"); console.log(data); To run the above program, save the file name anyName.html (index.html). Right click on the file and select the option “Open with Live Server” in VS Code editor.OutputThe output is as follows −Output in the console −

530 Views
Let’s say the following are our radio buttons, which we have set checked −Gender Male FemaleTo uncheck, set the checked property to false using prop() in jQuery −$('input[id="yourChoice"]:checked').prop("checked", false);ExampleFollowing is the code − Live Demo Document Gender Male Female $('input[id="yourChoice"]:checked').prop("checked", false); To run the above program, save the file name anyName.html (index.html). Right click on the file and select the option “Open with Live Server” in VS Code editor.OutputThe output is as follows −

244 Views
To make checkboxes impossible to check, set disabled property to true −JavaScriptFollowing is the code −ExampleFollowing is the code − Live Demo Document List Of Subject names MySQL JavaScript MongoDB To run the above program, save the file name anyName.html (index.html). Right click on the file and select the option “Open with Live Server” in VS Code editor.OutputThe output is as follows −You cannot check the checkbox value above since we have disabled it.

171 Views
To count how many times a user presses the button, you need to set counter on button click.ExampleFollowing is the code − Live Demo Document Press Me The current Value is= 0 var increment = 0; var current = document.getElementById('incrementThisValue'); document.getElementById('pressButton').onclick = (event) => { current.textContent = ++increment; }; To run the above program, save the file name anyName.html (index.html). Right click on the file and select the option “Open with Live Server” in VS Code editor.OutputThe output is as follows −When you press ... Read More

2K+ Views
For this, use jQuery(selector).toolTip().ExampleFollowing is the code: − Live Demo Document Write Your Favourite Subject Name: jQuery(".demoTooltip").toolTip() To run the above program, save the file name anyName.html (index.html). Right click on the file and select the option “Open with Live Server” in VS Code editor.OutputThe output is as follows −When you will hover the mouse inside the text box, you will get your tooltip −Your Favourite Subject may be JavaScript...Displayed in the below screenshot as well −

461 Views
To toggle content, use slideToggle() in JavaScript.ExampleFollowing is the code: − Live Demo Document .firstDiv { display: none; } .txtBox { display: block; } Press Me to toggle the text box Enter your name: function toogleTheTextBox() { $('#firstDiv').slideToggle(function () { $('#txtBox').focus(); }); } To run the above program, save the file name anyName.html (index.html). Right click on the file and select the option “Open with Live Server” in VS Code editor.OutputThe output is as follows −Press the button “Press Me” to toggle the text box.OutputThe output is as follows −

164 Views
Let’s say the following are our numbers with object values −var numberObject = { 2:90 , 6: 98 }Use Array.from() in JavaScript −var fillThePositionValue = Array.from({length: 15}, (value, index) => numberObject[index+ 1] || "novalue")ExampleFollowing is the code to loop numbers with object values −var numberObject = { 2:90 , 6: 98 } console.log("The actual object is="); console.log(numberObject); var fillThePositionValue = Array.from({length: 15}, (value, index) => numberObject[index+ 1] || "novalue") console.log("After filling the value, the actual object is="); console.log(fillThePositionValue)To run the above program, you need to use the following command −node fileName.js.Here, my file name is demo215.js.OutputThe output is as follows ... Read More

1K+ Views
To check the value for percentage, use a regular expression. When dealing with user input or processing data in JavaScript, it's important to make sure a value is a valid percentage. This article shows you how to check if a value is a percentage using JavaScript, highlighting a useful method that involves regular expressions. Let's say the following is our value var value="97%"; To check the value for percentage, we are using a regular expression. Using Regular Expression The best way to check if a string is in the correct percentage format is by using regular expressions. ... Read More

168 Views
To implicitly mimic click(), you can call a function internally.ExampleFollowing is the code to implicitly mimic click − Live Demo Document My Name is John Doe demo1Data = document.getElementById('demo1').innerHTML demo1Data = demo1Data.replace('My Name is John Doe', `My Favourite Subject is JavaScript..`) document.getElementById('demo2').innerHTML = demo1Data function replaceData() { document.getElementById('output').innerHTML = 'I live is US.'; } document.getElementById('demo2').querySelector('span').click(); To run the above program, save the file name anyName.html (index.html). Right click on the file and select ... Read More