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!