How to set innerText value for li using query selector in angular 8

120
February 10, 2020, at 6:10 PM

Tried to set innertext to third li of ul in angular 8 but not working.How to select ul and third li using queryselector to find the solution

app.component.html:

<tr>
<div class="wrapper">
  <ul>
    <li><span>Test 1</span></li>
    <li><span>Test 2</span></li>
    <li><span>Test 3</span></li>
    <li><span>Test 4</span></li>
    <li><span>Test 5</span></li>
  </ul>
</div>
</tr>

app.component.ts:

setInnertext(event){ 
    let getTr=event.target.closest('tr');
    getTr.querySelector('.wrapper').querySelector('ul').querySelector('li:nth-child(3)').innerText="New Name";
  }
READ ALSO
Javascript check first checkbox only

Javascript check first checkbox only

I have some code that repeat a multiple times with some checkboxes in it

129
HTML5 Audio on Desktop Safari: Long Delay

HTML5 Audio on Desktop Safari: Long Delay

I'm working on a website with a music playlistThe code is very straightforward, I use one <audio> tag with preload="true", then whenever a track is clicked on the playlist I use JS to change the source, then I load and play the track with audio

108
Map function returns undefined

Map function returns undefined

Im getting undefined on my app = TypeError: Cannot read property 'map' of undefined and my consolelog(cartoons) and i dont know what the issue is

166
MEVN Stack update document field in mongodb cloud

MEVN Stack update document field in mongodb cloud

I have trouble updating data in mongodb through a parameterI have successfully done it in JavaScript but can't get it working with Express in Node

109