I am using material css to have chips in html for a blog post. Here is the html rendering for chips.
<div style="padding-top: 10px;" id="post-tags-5fa1e733b4da1534a9096545">
<a href="">
<div class="chip">1st</div>
</a>
<a href="">
<div class="chip">2nd</div>
</a>
<a href="">
<div class="chip">3rd</div>
</a>
</div>
Now I am trying to edit the post and make the tags editable. So I am using jQuery to get the text.
var post_tags = $('#post-tags-'+post_id).text();
But I want to preload it in my edit post modal. Is there any easy way to do it ?
$('.chips-initial').material_chip({
data: [{
tag: '1st',
}, {
tag: '2nd',
}, {
tag: '3rd',
}],
});