+ 2

I want to create a text slider.But this code is throwing an error.Please help me with the JS portion.

https://code.sololearn.com/Wnv6wiA1hV8X/?ref=app

16th Oct 2018, 10:35 AM
Aanisha Bhattacharyya
Aanisha Bhattacharyya - avatar
8 Respostas
+ 3
Sololearn puts the script tag for the js in the head so when the showSlides() function runs it does so before HTML loads which results in undefined values when you try interacting with the DOM. To fix that use window.onload which will run code once the HTML loads: window.onload = () => { showSlides(slideIndex); } You can give window.onload a proper function if you want e.g. a function called start: function start() {} window.onload = start; Extra: change the a tags into buttons
16th Oct 2018, 11:17 AM
TurtleShell
TurtleShell - avatar
+ 2
look at this and see if it helps https://code.sololearn.com/WGOl85408P8d/?ref=app
16th Oct 2018, 4:37 PM
BroFar
BroFar - avatar
+ 1
TurtleShell Thanks bt its still not helping.Can you see to it?
16th Oct 2018, 12:00 PM
Aanisha Bhattacharyya
Aanisha Bhattacharyya - avatar
+ 1
Aanisha Bhattacharyya not the whole thing just showSlides() function the way I showed you.
16th Oct 2018, 12:04 PM
TurtleShell
TurtleShell - avatar
+ 1
TurtleShell its not helping still now
16th Oct 2018, 4:43 PM
Aanisha Bhattacharyya
Aanisha Bhattacharyya - avatar
+ 1
Aanisha Bhattacharyya I know I'm late to the party but look at my code here and it may help
16th Oct 2018, 4:48 PM
BroFar
BroFar - avatar
16th Oct 2018, 5:50 PM
TurtleShell
TurtleShell - avatar
0
TurtleShell there seems to be an issue with the carousel on both codes ~ review mine
16th Oct 2018, 6:01 PM
BroFar
BroFar - avatar