Skip to content

Tag: javascript

Iterate over a list of values using javascript

I am looking to iterate over a list of values using javascript. I have a list like this My goal is to pass each row into different functions based on the label. I am trying to figure out if a multidimensional array is the best way to go. Answer You get to define the matchesLabel function, it should return tru…

When is an event.target.value not a string?

I came accross value = String(event.target.value || “”) when a textinputs keyup/keydown event is fired. But i’m not sure when the event.target.value is not a string? Is this possible? When is something else passed off as an event.target.value? Answer If the event.target element is not an inp…

Push multiple elements to array

I’m trying to push multiple elements as one array, but getting an error: I’m trying to do similar stuff that I’d do in ruby, I was thinking that apply is something like *. Answer When using most functions of objects with apply or call, the context parameter MUST be the object you are working…

Google Places Autocomplete Force Selection

I am using the JavaScript Google places autocomplete API v3. It works fine but I was wondering if there was a way to force the selection from the autocomplete, that is input that will not accept any free form text. I looked at the docs and didn’t see such an option but figured I would ask just to be saf…

Capture events in list

I would like to know how to capture events within the dropdown list when a user click on a “select” dropdown list. I would like for example to intercept events when different elements of list are on focus. I tried to tie event listeners to the option elements of the list but they do not capture an…

How to disable the inputEl of a textfield in ExtJS?

I am working with ExtJS and I have a textfield component. I would like to disable only the inputEl of a textfield component (not the label). If I use the setDisabled() method of the textfield, then it sets disabled the inputEl but also the label. I have used also the setReadOnly() method, but it does not grey…