kembali ke pelajaran
Materi ini hanya tersedia dalam bahasa berikut: English, Espa??ol, Fran??ais, Italiano, ?????????, ?????????, ??????????????, T??rk??e, ????????????????????, ????????????. Tolong, menerjemahkan ke dalam Indonesia.

Insert the HTML in the list

pentingnya: 5

Write the code to insert <li>2</li><li>3</li> between two <li> here:

<ul id="ul">
  <li id="one">1</li>
  <li id="two">4</li>
</ul>

When we need to insert a piece of HTML somewhere, insertAdjacentHTML is the best fit.

The solution:

one.insertAdjacentHTML('afterend', '<li>2</li><li>3</li>');