Git Product home page Git Product logo

Comments (3)

fschiettecatte avatar fschiettecatte commented on July 29, 2024

Have you tried item.data[1] ?

François

On Nov 30, 2012, at 8:57 AM, Rafaelius [email protected] wrote:

Hi there,

I'm having a problem that i couldn't solve by myself. I'll have de data parameter as an array of array, where the first position will be the name of the user, and the second, will be the id, like shown on the example.

data: [
['Rafael Lira', 1],
['John Example', 2],
['Bob Test', 3]
]

on the "onItemSelect" option, i want to catch the this id (the second parameter, the number) and write it on the Value of an input type hidden.

I did that by capturing the "item.data" value, wich returns me the number.

Ex:
onItemSelect: function(item) {
var id = item.data;

    $("input[type=hidden]").val(id);
}

But when i try to write it on the input hidden, it writes the name (text) and not the number.

Am i doing something wrong? Any ideias?

Thanks!


Reply to this email directly or view it on GitHub.

from jquery-autocomplete.

Rafaelius avatar Rafaelius commented on July 29, 2024

Yes, it says undefined.

from jquery-autocomplete.

fschiettecatte avatar fschiettecatte commented on July 29, 2024

I just tried it using the $("#ac3") example on this page:

https://github.com/dyve/jquery-autocomplete/blob/master/demo/index.html

and with your data, and item.data gives me the number as expected.

François

On Nov 30, 2012, at 9:12 AM, Rafaelius [email protected] wrote:

Yes, it says undefined.


Reply to this email directly or view it on GitHub.

from jquery-autocomplete.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.