Web Development Articles

Page 699 of 801

Find the Sum of Radio button values jQuery?

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 581 Views

Let’s say we have marks records and we need to sum them. The records are displayed in Radio Button −Marks1 75 {          if (evnt.checked) {             total = total + parseInt(evnt.value);             return;          }       });       secondMark.forEach((evnt) => {          if (evnt.checked) {             total = total + parseInt(evnt.value);             return;          }       });       ...

Read More

Way of validating RadioBoxes with jQuery?

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 234 Views

Following is how you can validate RadioBoxes with jQuery −ExampleFollowing is the code −            Document           Gender:       Male       Female             isStudent:       yes       No                    var nameValues = 'gen;student'.split(';');    $(function () {       $("form").on("submit", function (ev) {          if (nameValues.filter(val => $(`input[name=${val}]:checked`).length === 0).length > 0) {     ...

Read More

Change input type value attribute in jQuery

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

Let’s say the following is our input type with value, “John Smith” −To change, use the attr() method −$('#changeTheName').attr('value', 'Please enter your name.......');You need to use the concept of attr(). Following is the code −Example Document    $('#changeTheName').attr('value', 'Please enter your name.......'); 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

How to hide table rows containing zero value with jQuery?

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

Let’s say the following is our table with product quantity records − qty: qty: qty: qty: Let us now hide using the hide() method. Following is the code −Example Document qty: qty: qty: qty:    $('.hideRowContainingZeroValue input').filter(function(){       return +this.value === 0;    }).closest("tr").hide() 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

Fetch value from Alert pop up in jQuery

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 624 Views

To fetch value from alert pop up, use alert(). At first, use prompt() to input the value from user. Following is the code −Example Document    var value = prompt("Please enter an integer value");    var multiplyBy10=10*value;    alert("Result after multiplying by 10 = "+ multiplyBy10); 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 −Put an integer value and click the OK button.After clicking the OK button, the snapshot is as follows −

Read More

How to print div content using jQuery?

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

Let’s say we have the following button −On click of the above button, call the function() with on() −$('#buttonId').on('click', function () {    displayTheData(); })The above function is using the html() to display the following div −    I am inside the div tag... ExampleFollowing is the complete code to print div content −            Document           I am inside the div tag...        I am not inside the div tag...            $('#buttonId').on('click', function () { ...

Read More

How to populate select list with jQuery?

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

To populate select list with jQuery, use for loop along with append() and append the options to the already created select.Let’s say we have the following select with options − John David ExampleFollowing is the code to append more number of options using append() −            Document           John       David     $(document).ready(function () {    var data = [       { "name": "Bob", "customerName": "Bob" },       { "name": "Mike", "customerName": "Mike" }    ];    for (var index = 0; index

Read More

How to enable the "disabled" attribute using jQuery on button click?

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

Set the disabled property to true in jQuery −ExampleFollowing is the code −         Document             $("#change").click(function (buttonEvent) {     buttonEvent.preventDefault();     $('#showTxtBoxHide').prop("disabled", 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 −The text box property is disabled. To enable, you need to click the button −

Read More

How to Implicitly mimic click() in jQuery?

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 220 Views

To implicitly mimic click(), you can call a function internally.ExampleFollowing is the code to implicitly mimic click −            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 the ...

Read More

Slide up and down of a div animates its content - jQuery?

AmitDiwan
AmitDiwan
Updated on 11-Mar-2026 516 Views

To toggle content, use slideToggle() in JavaScript.ExampleFollowing is the code: −            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 −

Read More
Showing 6981–6990 of 8,010 articles
« Prev 1 697 698 699 700 701 801 Next »
Advertisements