Web Development Articles

Page 70 of 801

How do I check whether a checkbox is checked in jQuery?

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 362 Views

To check whether a checkbox is checked in jQuery, use the concept of toggle(). Following is the code −Example Document Your name is Adam Smith    $('#selectName').click(function() {       $("#txtName").toggle(this.checked);    }); To run the above program, just save the file name anyName.html(index.html) and right click on the file and select the option open with live server in VS Code editor.OutputThis will produce the following output −When you select the check box, the following will be the output −

Read More

Display all the values of an array in p tag on a web page with JavaScript

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 809 Views

For this, you can use .data(anyArrayObject). Following is the code −Example Document    const arrayValues = [1000000001,"John","Smith",100, 200, 3000]    var originalData = d3.select("body").selectAll("p")    .data(arrayValues)    .enter()    .append("p")    .text(function(allValuesOfArray){       console.log(allValuesOfArray+" ");       return allValuesOfArray;    }) To run the above program, just save the file name anyName.html(index.html) and right click on the file and select the option open with live server in VS Code editor.OutputThis will produce the following output −

Read More

Child node count in JavaScript?

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 749 Views

Use children.length to get the count of child node.Example Document List Of Subject Names are as follows: Javascript MySQL MongoDB Java Python    var arrayValueOfSubject =    document.getElementById('subjectName').parentNode;    console.log("The count of child node    is="+arrayValueOfSubject.children.length); To run the above program, just save the file name anyName.html(index.html) and right click on the file and select the option open with live server in VSCode Editor.OutputThis will produce the following output −

Read More

Set scroll view with intervals in JavaScript

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 761 Views

For this, use the concept of scrollTop and scrollHeight.Example Document    #scrollDemo {       height: 300px;       overflow-y: scroll;    }    #scrollDataFeatures {       height: 500px;       background-color: skyblue;    } See the below Message and Scroll UP    var scrollData = document.getElementById("scrollDemo");    scrollData.scrollTop = scrollData.scrollHeight    setInterval(() =>{       var heading3Data = document.createElement("h3");       heading3Data.innerHTML = "Scroll Down...Please Scroll UP"       scrollData.appendChild(heading3Data);       scrollData.scrollTop = ...

Read More

How to make my textfield empty after button click in JavaScript?

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 2K+ Views

For this, you can use onclick=”yourFunctionName()”, and −document.getElementById(“”).value=’’Example Document ClearInputText    function clearTheTextField(){       console.log("The text box       value="+document.getElementById('txtBox').value)       document.getElementById('txtBox').value = '';    } To run the above program, just save the file name anyName.html(index.html) and right click on the file and select the option open with live server in VS Code editor.OutputThis will produce the following output −Now enter some value into the text box and click the button ClearInputText.After entering the value, clicking the button.This will produce the following output −

Read More

Display the dropdown’s (select) selected value on console in JavaScript?

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 3K+ Views

Let’s say the following is our dropdown (select) −    Javascript    MySQL    MongoDB    Java Following is the code to display the selected value on Console −Example Document Javascript MySQL MongoDB Java    function selectedSubjectName() {       var subjectIdNode = document.getElementById('subjectName');       var value =       subjectIdNode.options[subjectIdNode.selectedIndex].text;       console.log("The selected value=" + value);    } To run the above program, save the file name “anyName.html(index.html)” and right click on the file. Select the option “Open ...

Read More

Multi-selection of Checkboxes on button click in jQuery?

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 514 Views

For this, use jQuery() with id property. Following is the code −Example Document    .changeColor {       color: red    }; Javascript MySQL MongoDB Python    jQuery("#selectDemo").click(function () {       jQuery(this).toggleClass("changeColor");       if (jQuery(this).hasClass("changeColor")) {          jQuery(".isSelected").prop("checked", true);          jQuery(this).val("Want To UnSelect All Values");       } else {     ...

Read More

How to avoid inserting NULL values to a table with JavaScript?

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 652 Views

In order to get rid of null values inserted into a table, you need to check the condition while entering the value.The condition to check NULL must be as follows −while( !( yourVariableName1==null || yourVariableName2==null || yourVariableName3==null…...N){    // yourStatement1    .    .    N }The above logic will never allow inserting the null values.Now you can use for loop and insert value into the table without NULL. Following is the code −Example Document Demo Of Inserting the value into the table This is demo on the javascript array ...

Read More

Implement Onclick in JavaScript and allow web browser to go back to previous page?

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 490 Views

For reaching the back page on button click, use the concept of −window.history.go(-1)Example Document To run the above program, save the file name “anyName.html(index.html)” and right click on the file. Select the option “Open with Live Server” in VS Code editor.OutputThis will produce the following output −After clicking the button “Click the button to Goto the Previous Page....”, you will reach the previous page as in the below screenshot −

Read More

How do I trigger a function when the time reaches a specific time in JavaScript?

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 3K+ Views

For this, extract the time of specific date time and call the function using setTimeout(). The code is as follows −Example Document    function timeToAlert() {       alert("The time is 9:36 AM");    }    var timeIsBeing936 = new Date("08/09/2020 09:36:00 AM").getTime()    , currentTime = new Date().getTime()    , subtractMilliSecondsValue = timeIsBeing936 - currentTime;    setTimeout(timeToAlert, subtractMilliSecondsValue); To run the above program, save the file name “anyName.html(index.html)” and right click on the file. Select the option “Open with Live Server” in VS Code editor.OutputThis will produce the following output −

Read More
Showing 691–700 of 8,006 articles
« Prev 1 68 69 70 71 72 801 Next »
Advertisements