Weird code function
i have a problem with the i < (long code)
the problem is it doesn't take the number
so for example if a put it to i < 4
it works but the other way doesn't
here's the code:
<form action="">
<input type="number" name="elements" class="input" placeholder="Number Of Elements" />
<input type="text" name="texts" class="input" placeholder="Elements Text" />
<select name="type" class="input">
<option value="Div">Div</option>
<option value="Section">Section</option>
</select>
<input type="submit" name="create" value="Create" />
<div class="results"></div>
</form>
26 Replies
please send your code with ```js
sorry i didn't understand
```js
code
```
Ayways what do you think this do?
i have an input in the html and this should get its value
I'm trying to do like this
No,
.addEventlistener
creates a listener, in your case of the input, so you're basically saying if i
is less than listener
, which doesnt make any sense, listener
is not a numberyes that's why there's a .value at the end of it
so i only get the value out of it
Yes but it doesnt return the value
why
because addEventListener just creates a listener, doesnt return anything
ok then do i do it
i need a method that gives me the live value of the input
and addEventListener is the only one who can do it like this
is this possible ???
yep, you can just take the value by doing numberOfElements.value
it's not working
does it give you an error?
yes
what
it's just missing a ) at line 29
I dont have the full code so I cant help you
no i just added the =>
ok there's another problem
OHHHHHHHHHHHHMYYYYYYYYGOOOOOOOOOOD
IT WORKED
THANK YOU SIR
Do you understand what it did?
and how it works
probably yes