Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

148
Visualizações
retrieve the id from the mention.js on select

I am using mention.js basic example

   $('textarea.mention-example2').mentionsInput({
    onDataRequest:function (mode, query, callback) {
        $.getJSON('DataTableJsonFils/systmeQ.json', function(responseData) {
            responseData = _.filter(responseData, function(item) { return item.name.toLowerCase().indexOf(query.toLowerCase()) > -1 });
            callback.call(this, responseData);
        });
    }
});

I have this json array as the data for this example

[
  {
    "id": 1,
    "name": "Kenneth Auchenberg",
    "avatar": "http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif",
    "type": "contact"
  },
  {
    "id": 2,
    "name": "Jon Froda",
    "avatar": "http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif",
    "type": "contact"
  },
  {
    "id": 3,
    "name": "Anders Pollas",
    "avatar": "http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif",
    "type": "contact"
  },
  {
    "id": 4,
    "name": "Kasper Hulthin",
    "avatar": "http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif",
    "type": "contact"
  },
  {
    "id": 5,
    "name": "Andreas Haugstrup",
    "avatar": "http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif",
    "type": "contact"
  },
  {
    "id": 6,
    "name": "Pete Lacey",
    "avatar": "http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif",
    "type": "contact"
  },
  {
    "id": 7,
    "name": "kenneth@auchenberg.dk",
    "avatar": "http://cdn0.4dots.com/i/customavatars/avatar7112_1.gif",
    "type": "contact"
  }
]

the filter is working fine. my question is how can i get the id value when i select a result from the filter and not the name. I would like to keep filtering over the name value but on select display the id

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda