Manish
Manish

Reputation: 1326

Prefilling Tags Manager

I am using

http://welldonethings.com/tags/manager

I want to prefill the tags.

I'm using something similar to below code which works fine. i.e it shows both tags Pisa and Rome

jQuery(".tm-input").tagsManager({
    prefilled: ["Pisa", "Rome"]
});

but when do this it shows only first tag. i.e garlic

<input 
    type="hidden" 
    name="HiddenFieldSubIngredients" 
    id="HiddenFieldSubIngredients" 
    value="garlic,onion" />
var subingredient = $("#HiddenFieldSubIngredients").val();
var subingredients = subingredient.split(',');
$(".tm-SubIngredient").tagsManager({ prefilled: [subingredients] });

Any help would be appreciated.

Upvotes: 2

Views: 711

Answers (1)

Rory McCrossan
Rory McCrossan

Reputation: 337570

You are supplying an array in an array to the plugin. Try this instead, without the square brackets:

$(".tm-SubIngredient").tagsManager({ prefilled: subingredients });

Upvotes: 2

Related Questions