jQuery Tutorial #2 - DOM functions and array
Creating boxes with repeating background color - jQuery practice In this article, we’ll cover how to use jQuery , DOM methods , and JavaScript arrays to create interactive boxes with repeating background colors. You could try our previous practice exercise for hands on jquery knowledge. Jquery array i) When you get an input, check whether it is validated as a number. ii) Based on the input value, create a number of boxes. iii) Set all the boxes with background colors from an array. How to Get an Input Value from a Textbox var inputValue = $(this).val(); console.log(inputValue); Testing Whether the Input Value is a Number To test whether the input is a number, we use a regular expression pattern. if (/^[0-9]$/.test(inputValue)) { console.log("It is...