Found 8591 Articles for Front End Technology

How to sort an HTML table using JavaScript?

AmitDiwan
Updated on 09-Nov-2023 14:46:38

2K+ Views

To sort an HTML table using JavaScript, the code is as follows − JavaScript function to sort an HTML Table Consider the following sort function using JavaScript, that will be used to sort an HTML table.   function sortTable() {     var filterTable, rows, sorted, i, x, y, sortFlag;     filterTable = document.querySelector(".filterTable");     sorted = true;     while (sorted) {      sorted = false;      rows = filterTable.rows;      for (i = 1; i < rows.length - 1; i++) { ... Read More

How to sort an HTML list using JavaScript?

AmitDiwan
Updated on 06-May-2020 14:29:47

1K+ Views

To sort an HTML list using JavaScript, the code is as follows −Example Live Demo Sorting list example Click to sort Giraffe Camel Dog Lion Cheetah Cat    document .getElementsByTagName("button")[0] .addEventListener("click", sortList);    function sortList() {       var list, i, sortFlag, LiEle, sorted;       list = document.querySelector(".animalList");       sortFlag = true;       while (sortFlag) {          sortFlag = false;          LiEle = list.getElementsByTagName("LI");          for (i = 0; i < LiEle.length - 1; i++) {         ... Read More

How to create a file upload button with HTML?

AmitDiwan
Updated on 21-Nov-2023 21:12:19

1K+ Views

To create a file on upload button with HTML, the code is as follows −Example File upload button example Click on the "Choose File" button to upload a file: OutputThe above code will produce the following output −On clicking the “Choose file” button −

How to turn off spell checking (grammar correction) for HTML form elements?

AmitDiwan
Updated on 06-May-2020 14:07:54

159 Views

To turn off spell check for form elements, the code is as follows −Example Live Demo Disabling Spellcheck Example Your Name: About Yourself Type wrong spelling in the above input field to see spellcheck in action OutputThe above code will produce the following output −On typing something in the input fields −

How to disable autocomplete of an HTML input field?

AmitDiwan
Updated on 06-May-2020 14:05:06

317 Views

To disable autocomplete of an input field, the code is as follows −Example Live Demo    input{       font-size: 18px;       padding: 10px;       margin: 10px;       border:1px solid grey;    } Autocomplete on/off Example First name: Last name: Type in the above fields and refresh page to see autocomplete at work OutputThe above code will produce the following output −On typing something in the above fields after submitting the form one time −

How to create a password validation form with CSS and JavaScript?

AmitDiwan
Updated on 08-Dec-2023 15:20:47

2K+ Views

On a registration page, you must have seen an input filed to set the password. On entering the password, the validation system suggests you how to construct a password. For example, a password should have at least a number, character, it should be minimum 8 characters. In this tutorial, we will see how to set the same password validation form on a web page. On typing to set the password the validation system will suggest the correct suggestions. Let us see how. Create a form The element is used to create a form on a web page. Two ... Read More

How to trigger a button click on keyboard "enter" with JavaScript?

AmitDiwan
Updated on 06-May-2020 13:38:04

1K+ Views

To trigger a button click on keyboard "enter" with JavaScript, the code is as follows −Example Live Demo Trigger Button Click on Enter Example Button Press the "Enter" key inside the above input field to trigger the button.    var inputText = document.getElementById("inputField");    inputText.addEventListener("keyup", function(event) {       if (event.keyCode === 13) {          event.preventDefault();          document.getElementById("alertBtn").click();       }    }); OutputThe above code will produce the following output −On typing something in the field and then pressing enter −

How to create custom select boxes with CSS and JavaScript?

AmitDiwan
Updated on 14-Dec-2023 16:29:43

587 Views

A select box allows you to create a dropdown for users to select a specific value from a list. These generally appear when let’s say you want to a user to select a degree from a list of degrees, favourite sports from a list of popular sports, etc. Let us see how to create custom select boxes with CSS and JavaScript. The color of the select box, the appearance, etc. can be easily changed. Let us see how − Create a container for the select box First, create a container div for the select boxes. Option value 0 is where ... Read More

How to create a responsive navigation menu with a login form inside of it with HTML and CSS?

AmitDiwan
Updated on 06-May-2020 13:14:18

521 Views

To create a responsive navigation menu with a login form inside of it, the code is as follows −Example Live Demo Document    body {       margin: 0px;       margin-top: 10px;       padding: 0px;    }    nav {       width: 100%;       background-color: rgb(39, 39, 39);       overflow: auto;       height: auto;    }    .links {       display: inline-block;       text-align: center;       padding: 14px;       color: rgb(178, 137, 253);     ... Read More

JavaScript ArrayBuffer.isView()

AmitDiwan
Updated on 06-May-2020 12:37:53

216 Views

The ArrayBuffer.isView() method tells us if the passed parameter value is an ArrayBuffer view or not.Following is the code for ArrayBuffer.isView() method −Example Live Demo Document body {    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; } .sample {    font-size: 20px;    font-weight: 500; } JavaScript ArrayBuffer.byteLength property CLICK HERE Click on the above button to check the above value is array buffer view or not let fillEle = document.querySelector(".sample"); var buffer = new ArrayBuffer(8); var view1 = new DataView(buffer); view1.setInt16(0, 0x2721); fillEle.innerHTML = view1.getInt16(0).toString(16); document.querySelector(".Btn").addEventListener("click", () => {   ... Read More

Advertisements