I have used following jquery for my project.
I want to set initialTags parameter of tagEditor() from attribute of textarea..
For example:
<textarea id="demo3" data-json=""></textarea>
$('#demo3').tagEditor({
initialTags: $(this).attr("data-json"),
placeholder: 'Enter tags ...'
});
But here it doesn't work.. Can anyone help me with this???
this
in this context isn't the matched element. What you can do is to use a cached variable:
var $demo3 = $('#demo3');
$demo3.tagEditor({
initialTags: $demo3.data("json"),
placeholder: 'Enter tags ...'
});
But don't forget than initialTags
must be an array.