Category : html-lists

I am trying to append a new li item along with the close element to my list in this to do list web-project.Why isn’t it working? Here is my js code: addbutton=document.getelementbyid("addbutton"); > addbutton.addeventlistener(‘onclick’, addtolist); function > addtolist(e){ const ultag=document.queryselector("#myUL"); > const myinputvalue=document.getelementbyid("myinput").value; > const newli=document.createelement("li"); newli.innerHTML=myinputvalue; > ultag.appendchild(newli); > const addedx=document.createelement("span"); addedx.innertext="x"; > added.classname="close"; ..

Read more

I have 3 li’s and want to get all variables of the clicked li (name,distance,Ort,PLZ). I’m new in Javascript and I’m thankfull for every help. const li = ` <li id= "${doc_id}"> <div class="collapsible-header grey lighten-4 right-align"> ${name} ${distance}km from you (${Ort},${PLZ}) </div> <div class="collapsible-body white"><span>hey</span> </li> <li id= "${doc_id}"> <div class="collapsible-header grey lighten-4 right-align"> ..

Read more

// If checked, set display to ‘initial’ otherwise set it to ‘none’. function check(event) { let ol = document.getElementById(‘list’); if (event.currentTarget.checked) { ol.style.display = ‘initial’; } else { ol.style.display = ‘none’; } } show.addEventListener(‘click’, check, false); ol {display: none;} label {user-select: none;} <input id=”show” type=”checkbox” /> <label for=”show”>Show list</label> <ol id=”list”> <li>list</li> </ol> The list ..

Read more

I have a li select checkbox with five items and i want to append another items using javascript <div class="form-group"> <label for="exampleSelect1" class="form-label mt-4">Sub Type</label><br> <div id="list1" class="dropdown-check-list" tabindex="100"> <span class="anchor">Select Fund Type</span> <ul class="items"> <li><input value="1" type="checkbox" /> Apple </li> <li><input value="1" type="checkbox" /> banana </li> <li><input value="1" type="checkbox" /> tomato </li> <li><input value="1" ..

Read more