Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

146
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!