Javascript DOM errors

前端 未结 5 1067
没有蜡笔的小新
没有蜡笔的小新 2021-01-25 13:45

this is my javascript code , I am trying to create a dynamic list in HTML with data I recieve from the server , The data is of type \"json\"

My Javascript snippet

5条回答
  •  孤街浪徒
    2021-01-25 14:24

    This line in your loop creates multiple list items with the same ID:

    listItem.setAttribute('id','gBookListItem');
    

    try removing it - i don't think you need it.

提交回复
热议问题