How can I use two fields at the same time for jquery token input plugin

43 views Asked by At

The prepopulate looks like below :

prePopulate: [ {id: 57787, name: "harry potter"}],

The two input text fields are below

<input name="field1" id="field1" type="text" style="width: 80%;" />
<input name="field2" id="field2" type="text" style="width: 80%;" />

jQuery("#field1").tokenInput(getTokenInputURL, {
    preventDuplicates: true,
    <?php
    echo $prePopulate;
    ?>
    hintText: "some text",
    noResultsText: "some text",
    searchingText: "some text"
});

jQuery("#field2").tokenInput(getTokenInputURL, {
    preventDuplicates: true,
    <?php
    echo $prePopulate;
    ?>
    hintText: "some text",
    noResultsText: "some text",
    searchingText: "some text"
});

I have tried creating prePopulate1 and prePopulate2 ,but that didnot work. Can anyone please help me with creating two different fields which use same jquery input token.

0

There are 0 answers