+ 1
Can I set a variable to match a value on javascript
Let's say this function function pic1 (){ var carrete = document.getElementsByTagName('button'); pic = valueof button Would that work if button value is 1 on JavaScript?
4 Respostas
+ 2
When dealing with buttons, they don't value, but they do have a property called innerText that might work, you better try it because I'm not really sure. Never tried it myself.
+ 2
Hi Alandec,
Hope this give you more insight👍
https://code.sololearn.com/W67XhNStwZGr/?ref=app
+ 1
Hi 🌴Vincent Berger🌴 ,thanks for your answer, it's a little advance for my level, I'm a beginner and just experimenting with function, what I'm trying to do is, I have an array with 5 images and 5 buttons,1for each images, therefore,I set 5 different function,1 per button,I was wondering if there's a way to do the same with one single function, here's the full code
https://code.sololearn.com/WcLZQ5h6h848/?ref=app
+ 1
Alandec,
To accomplish a toggle mechanism between 2 functions with 1 button click:
https://www.sololearn.com/discuss/1543187/?ref=app
To execute multiple functions with 1 button click you can assign the onclick element with multiple functions:
onclick="one();two();three();"
Have a look at the changes👍😊
https://code.sololearn.com/WgSeRCe57nBA/?ref=app