+ 2
Why is my onclick setinterval not working
My onclick is inside a if statement and am trying to check which button is been clicked so that I can activate the on click functions https://code.sololearn.com/WqW08Lzyv4n3/?ref=app
18 odpowiedzi
+ 4
D Doyen
1 - single equal (=) is used for assign value to a variable
2 - double equal (==) is used to compare value
3 - how do you check button is clicked or not if there is no click event added?
4 - don't write custom function inside onload function.
5 - two is a list of nodes so you cannot add event like two.onclick
6 - first check if click event not occurs on button then add event
Do you want like this?
https://code.sololearn.com/WZObBA46bNec/?ref=app
+ 3
Make sure your if statement contains '==' and not '='
+ 3
D Doyen,
What's up? please explain clearly what you want this code do. For example, why you put event handler in a conditional ...
+ 2
Ipang
I have 2 text in quotes
One name arry and another arry1
And I have three buttons if I click button with index 0 I want arry to be written inside the button with index 0
And when the button with index 1 is clicked I want arry1 to be written inside the button with index 1
In form of typing animation
Thanks in advance
+ 2
D Doyen,
I modified your code and added some comments to explain. One thing I can't help you with, is the inconsistent position of button once their text was modified.
https://code.sololearn.com/WExTIz7A4a9H/?ref=app
+ 2
Ipang
Thanks for the fix it works perfectly
But can Pls tell me where you learnt everything you used because I have not heard of set attribute and the likes
Thanks in advance
+ 2
But thanks for the fix it was fantabulous mind blowing
And Pls tell me how you learn every thing
I mean links to website where you learnt those things
+ 2
And for the position changing I can fixed that I encountered it before
+ 2
D Doyen,
No problem
About setAttribute etc. I get more from what's available in the official course from reading community members' codes.
When I don't understand what something is, I either ask the code author, a friend, or search the net ...
Answers to questions in Q&A Discuss also teach me indirectly ...
+ 2
D Doyen,
I look forward to seeing your code be more properly indented in the future.
Indentation improves code readabilty and it also helps when debugging codes 👍
+ 2
D Doyen,
Sorry I don't really have a particular source of learning so I don't know what to suggest. I was one of those guys who just pick things up as I go, from various places.
But w3schools, MDN and javascript.info might worth a visit.
+ 2
Ipang thanks
+ 1
+ 1
A͢J Pls the code you wrote is not working on my device
My device does not support advance javascript
+ 1
A͢J
Pls I want a typing animation in each button that is clicked
And I want each button to have it own text
+ 1
My own fix was this though it doesn't work properly
var arry = ("sola is my ghfffffejdj djdjdjdjjjj jjjjjjjjjebeuehbe wwm mmwo djdjjdjtfd hjsjs ussjsj name")
var arry1 =("def")
var w = 0;
var two = document.getElementsByTagName("img");
function run(j,arry){
function type(){
var four = document.getElementsByClassName("four");
var two = document.getElementsByTagName("img");
four[j].innerHTML += arry.charAt (w)
four[1].style.visibility="visible"
w++
}
setInterval (type,100)
}
two [0].onclick=function(){ run(0,arry)}
two[1].onclick =function(){ run(1,arry1)}
0
Ipang links
0
Hello can someone help me out with a doubt