Get object label and value - jQuery Tagit

Posted on 2012-09-14
Medium Priority
Last Modified: 2012-09-14
I'm trying to put constraints around text that can be entered into text box to only allow certain values to be selected.  When selected, I want to extract the ID for the object to use later.  

My thought was to use two boxes- one for the label that is visible to everyone and another for the ID that is hidden.    

In short, how do I allow people to select "Pizza" in the text box and capture the value "1" in another field?  If there are multiple values, a delimter "," should be used.  

I'm open to suggestions as to how to make this work, but was trying to improve the UI by using TagIT (link below).


    <input id="my_food" disabled="true">
    <ul id="singleFieldTags"></ul>

var food = [{label:'Pizza', value:1},{label:'Burger',value:2},{label:'Salad',value:3}]; 

    tagSource: food, 
    singleField: true, 
    singleFieldNode: $("#single")

Open in new window

Question by:Latitudes
1 Comment

Accepted Solution

Latitudes earned 0 total points
ID: 38400826


Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses
Course of the Month16 days, 4 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question