Skip to content

Tag: input

How to set textarea height using min-height?

I am trying to create a message input field, using textarea. The reason I am using textarea is to be able to dynamically change the height. To be able to dynamically change the height of the textarea and the parent divs, I have implemented this code. The code works, just fine. To be able to use this JavaScript code I

How sum specific array values with input onChange

I’m have a list of objects I need to sum two values in array with onChange input On every change values is summed I’m create input form and it’s works but change all my mapped values at once How can i change only one item in array at once on every onChange event? Answer You can make inputValue store an

Get the count of only disabled type=”number” input boxes

How can I expand this to count all input boxes in a form that is type=”number” but is currently disabled? I can count all the input boxes (which included checkboxes) but I want to only count the specific disabled boxes only. Answer I would use querySelectorAll (which deals with CSS selectors naturally) with the selector [type=”number”]:disabled. For example, as you

Prevent a Form Input value from being submitted in the form

I’m working on a form that askes the user what kind of “samples” of countertops they like. Here is the page: I’m using Webflow CMS and some jQuery to automatically name the checkboxes that toggle whether or not they like certain samples. To make it easier for the company to see what’s been checked, I’m trying to prevent all

JS doesn’t change the value of input

I’m writing cart-box that will change the quantity of products in cart. It works only if I have one box (one product) in cart, but when I have more products in cart it changes the value of the first input only. This is my html code (earlier in the code I’ve got loop for my products): And this is JS

How to get value from an input field from a class of input fields?

I wrote a code that contains several input fields of number type. They all have the same class and can have different values. But when I want to get a value from one of the input fields, the console log returns an undefined. Why’s that happening, and how to resolve this issue? Code: JS CSS HTML Answer var quantity =

Text flows out of input after next event is fired if input is focued

While building a basic application, when I click a button, the text inside my currently focused input overflows only in Chrome. However, that text can be accessed using (right) arrow key(s). Is there any way to avoid this? I tried clipboard copy-paste but that did not work. Live site: Code on Github: Answer The problem comes from this