i/p: name="tom" o/p: 7647
<pre> JSON data: var json=[{ name="bob", id="FYW1985274" },{ name="tom", id="FYW1687647" }] JS function xyz{ var loginName = document.getElementById("login").value var search = json.map(d => d.name) if(search.includes(loginName)){ json[i].id // i should be index of matching name // I do not know how to get corresponding id with last 4 digits for that name. } HTML <welcome id="login" name="{{name}}"></welcome> When i am trying to get name with id="login" it's giving me entire "Welcome name" but i want only name.
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)