Hello,
i think that there was an update on the code and now my code inside the onready function is not working.
I want to set the multiple selection input to a specific value when the page load.
I want to set the multiple selection input SET to value 1.
This is the code:
I don’t see a problem with your code. You do not need the .toString() since .toFixed() makes it a string, but this extra method call shouldn’t be a problem.
Do you mean a i should convert my number variabile into a string variable and then send it to the multiple selection input?
Not send it directly with a conversion?
If you are using elements in your project like…
-buttons
-images
-stripes
-boxes
…and so on…
Do yourself a favour and give them plausible IDs!
For example —> which element is in your project → “#set” ???
Is it a button?
Is it a box?
Is it a textfield?
Is it something else?
You as project-creator, you will be able to read your code faster than, someone-extern who you are asking for help, because nobody can see your project and it’s SETUP.
CONCLUSION:
You always should give good-readable IDs to every of your elements.
Example:
ID for a BUTTON —> “#btnFacebook” ← do you have any sugestions, what this element could be?
…or… —> “#txtFieldSet” <— ??? Still plausible enough?
The more your CODE will growing, the more difficult it will be to read your own CODE!
So if —> ‘#set’ <— is a TEXTFIELD or a INPUTFIELD it surely will expect a ---------------->STRING as value.
$w ( ’ #set ’ ). value = 1 ; —> VALUE = NUMBER
$w ( ’ #set ’ ). value = “1” ; —> VALUE = STRING
Ok this was helpful…
I have an other basic question:
How can i Add some additional space insidie my string into a textbox ?
Ex.
I need to write
Back squat 100
But i only get the result:
Back squat 100
"Back Squat" + " " + "100" //Just concatenating string
exerciseName + " " + variableName //Using concatenating variables in your strings
`Back Squat 100` //Using back ticks or template strings, is the way to go.
`${exerciseName} ${variableName}` //This would be the best way, you can insert many spaces between the variables in this template string