2
Guys, I’m having a hard time capturing the items inside an object on Json.
Follow the code below to illustrate.
var tipos = [
{
"code": "258",
"label": "Sapatos"
},
{
"code": "547",
"label": "Kits"
},
{
"code": "1213",
"label": "Whey Protein"
},
{
"code": "3110",
"label": "Bolas"
},
{
"code": "4316",
"label": "Camisas de Time"
},
{
"code": "1251",
"label": "Cuecas"
}];
console.log(types)
I can capture every array from the console.()
The problem is that I need to associate this in html, type , create a button (input) where the user will paste only the name of the product types and will return the code, or vice versa.
It would look something like this
The user types Balls and shall return {"code": "3110", "label": "Bolas"}
,
If he types Balls, Kits, shall return {"code": "3110", "label": "Bolas"}, {"code": "547","label": "Kits"}
Thank you so much for your help!
Face, button is not digitable, is an element to receive click.
– Sam
In fact I expressed myself badly, would not be button , would be a text box/ search.
– Thiago Maia
Utilize Array.filter to filter the elements.
– Valdeir Psr