+ 1

Passing Id

I made a code in js to pass the elements I'd but the script is not working on my desktop win vista. tried it with chrome and firefox. does anyone knows a solution? that's the code: https://code.sololearn.com/W0IPKZRI11ii/?ref=app

31st Oct 2018, 12:24 AM
jack
jack - avatar
4 ответов
+ 2
Your code is working fine. One problem I can see is, in your html, you're calling 'function a' with an argument 'this.id' but in your JS, the 'function a' isn't accepting any arguments. I think, you want to create something like this.. function a(id){ var p = document.createElement("p"); var node = document.createTextNode("Some new text"); p.appendChild(node); var div = document.getElementById(id); //adding the paragraph to the div div.appendChild(p); };
31st Oct 2018, 1:43 AM
Шащи Ранжан
Шащи Ранжан - avatar
+ 2
So, the problem is with win Vista, maybe?
31st Oct 2018, 2:49 AM
Шащи Ранжан
Шащи Ранжан - avatar
+ 1
that's not the thing I was writing the code while you where looking now the code is finish. on my desktop is even thefunction: function sth (id){alert (id);} not working. I called it with onclick
31st Oct 2018, 2:37 AM
jack
jack - avatar
31st Oct 2018, 2:39 AM
jack
jack - avatar