I have a problem in tagify library, I need to set data in input type tagify on click some button, but not set, this is my code
$(document).ready(function() {
$('#getInfo').on('click', function () {
$('#kt_tagify_1').val('tag name');
})
});
this is my library .md
I have a problem in tagify library, I need to set data in input type tagify on click some button, but not set, this is my code
$(document).ready(function() {
$('#getInfo').on('click', function () {
$('#kt_tagify_1').val('tag name');
})
});
this is my library https://github./yairEO/tagify/blob/master/README.md
Share Improve this question edited Dec 16, 2019 at 13:28 RedOne asked Dec 16, 2019 at 13:19 RedOneRedOne 731 gold badge3 silver badges8 bronze badges1 Answer
Reset to default 6The demo:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>Click Add Tag Demo</title>
<link rel="stylesheet" href="https://cdn.jsdelivr/npm/@yaireo/[email protected]/dist/tagify.css" />
<script src="https://cdn.jsdelivr/npm/@yaireo/[email protected]/dist/tagify.min.js"></script>
<script src="https://cdn.jsdelivr/npm/[email protected]/dist/jquery.min.js"></script>
</head>
<body>
<input type="text" name='basic' value="tag1, tag2" />
<button id="click">add tags</button>
<script>
var input = document.querySelector('input[name=basic]');
var tagify = new Tagify(input);
$("#click").on("click", function() {
var n = "ADD_IT_" + Math.random();
var tags = [];
tags.push(n);
tagify.addTags(tags);
})
</script>
</body>
</html>
You can find a methon on here https://github./yairEO/tagify#events
How to use: