How can i make summary src? | Sololearn: Learn to code for FREE!

+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.

12/13/2017 3:59:32 PM

Александр

5 Answers

New Answer

+1

Your while loop is always false. 0 will never be larger than 10.

+1

Whoops :D Wow! It's working. Hm. On JavaScript it doesn't work, but with jquery it work. Thanks! XD

+1

Wow. OK. Thanks.

-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

-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.