0

I have element as below:

<li class="someClass">value1<span>value2</span></li>

The above list element is generated through vanila js so the click event is bind to it as below:

const list = Array.from(document.querySelectorAll(".someClass"));
  list.forEach(ele => ele.addEventListener('click', this.getListValue.bind(this)));

getListValue(element)
{
 console.log('output', element.target.innerText)
}

In output I get on IE:

output value1 value2

chrome:

 output value1

I need only value1. Is there a way to get value of li tag for given scenario?

Thanks!

Always_a_learner
  • 4,585
  • 13
  • 63
  • 112
  • @Simer You might also want to have a look into [reactive forms](https://angular.io/guide/reactive-forms), using FormGroup, FormBuilder and FormArray. – Amadán Sep 20 '18 at 06:53