+ 1

How can i make summary src?

I need function function changer(element) { var foto = $("#slider").children(); var x = 0; while (x > 10) { var way = String(element.id) + '/' + String(x++) + '.jpg'; foto.eq(x).children().attr("src",way); } } But it doesn't work and I don't know why.

13th Dec 2017, 3:59 PM
Александр
5 Respuestas
+ 1
Your while loop is always false. 0 will never be larger than 10.
14th Dec 2017, 1:15 AM
John Wells
John Wells - avatar
+ 1
Whoops :D Wow! It's working. Hm. On JavaScript it doesn't work, but with jquery it work. Thanks! XD
14th Dec 2017, 12:28 PM
Александр
+ 1
Wow. OK. Thanks.
15th Dec 2017, 12:50 AM
Александр
- 1
Best way to debug any program is to add output statements. Putting a <p> on page for debugging with <div> parent allowing scrolling. HTML lines 40-42 CSS lines 22-26 JS lines 31, 35, 413, 422-423, 645-648, 759-761, 785-787 I change 31 to true to use. I use click on paragraph that doesn't change to toggle on or off in my current program I'm debugging. Also note, this was my first web program and as such has tons of things I would change, if I started today. I been programming for 44 years explaining it's complexity. https://code.sololearn.com/WAFrAL7FHPR2/?ref=app
14th Dec 2017, 6:09 PM
John Wells
John Wells - avatar
- 1
I would have stuck debug outputs before and after loop plus top and bottom in loop. Display contents of variables so you know exactly what is going on.
14th Dec 2017, 6:42 PM
John Wells
John Wells - avatar