Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8557793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:39:19+00:00 2026-06-11T15:39:19+00:00

I am using Jquery Tokeninput in my project to display some numbers in a

  • 0

I am using Jquery Tokeninput in my project to display some numbers in a textarea. I have a hidden input field in which I save the JSON string containing the numbers.
The JSON looks like

patents = [{"id":"AT02708872"},{"id":"DE60232348"},{"id":"EP02708872"},{"id":"SE0101087"},{"id":"SE0200504"}] 

in my view the hidden input is

  <input id="appln_nrs" type="hidden" value="{{ patents }}" />

In the same view I pass the value of this input to my JQuery Tokeninput as

<script type="text/javascript">
    $(document).ready(function() {
        var patents = $("#appln_nrs").val();
        //var patents = [{id:"ABC"},{id:"DEF"}];
        $("#patents").tokenInput("", {
            theme:"facebook",
            prePopulate: patents
        });
    });
</script>

The problem is the JSON contains only 5 entries with id and its value, but when I am on the view it display something like this in the textareaImage

But when I pass some hard coded JSON to patents variable it is displayed properly.

Any help will be highly appreciated.

Thanks

Edit

When I use in my javascript like

 var patents = {{ patents }};

it gives me the following syntax error

  SyntaxError: invalid property id
  [Break On This Error]     

  var patents = [{&quot;id&quot;:&quot;AT.02708872.T&quot;},{&quot;id&quot;:&quot;... 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:39:20+00:00Added an answer on June 11, 2026 at 3:39 pm

    Don´t use a hidden field. Just do:

    <script type="text/javascript">
        $(document).ready(function() {
            var patents = {{patents|raw}};
            //var patents = [{id:"ABC"},{id:"DEF"}];
            $("#patents").tokenInput("", {
                theme:"facebook",
                prePopulate: patents
            });
        });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have this jquery code which poplautes a input selector, which should display like
I'm using jQuery with tokeninput Plugin. I initialize it with: $(input#id).tokenInput(url, { defaultValue: Very
I am using Jquery tokenizer as like facebook using the following plugin http://loopj.com/jquery-tokeninput/ which
I am using jQuery tokeninput to pre-populate a text area. I have an array
I'm using this plugin: http://loopj.com/jquery-tokeninput/ to do a suggestion field, where the user can
I installed the JQuery token-input plugin. https://github.com/loopj/jquery-tokeninput Autocomplete is working, but I have a
I'm working on a project using jQuery Tokeninput . The plugin is described as
I'm using a heavily modified version of jquery-tokeninput it's essentially a text input box
Im using jquery-tokeninput, but a fork of it which allows the User to add
Using jQuery timepickr: http://archive.plugins.jquery.com/project/jquery-timepickr Having included these files: jquery-1.7.1.min.js jquery-ui-1.8.21.custom.min.js ui.timepickr.js And getting this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.