Using Jquery Tagit. I have the tagit input text window with predefined tags underneath the input window.
Clicking on the tags shown underneath populates the Tagit input text window - works fine. I would like to prevent the user from typing in the text window and ONLY allow the clicking of the available tags shown underneath the input window.
The code below allows the user to input custom tags, which I want to prevent.
I thought the HTML "disabled" would work, but it seems to get overriden by the Tagit program.
<div class="container">
<form id="the_form" method='post' action="" enctype="multipart/form-data">
<div class="form-group">
<label for="tags">For easy searching, choose the tags below or enter your own tags:</label>
<input class="form-control" name="myTags" type="text" id="myTags" value="">
<p class="super_tag" data-tag="tag">One</p>
<p class="super_tag" data-tag="tag">Two</p>
<p class="super_tag" data-tag="tag">Three</p>
<p class="super_tag" data-tag="tag">Four</p>
</div>
</form>
</div>
<script>
$(document).ready(function(){
//Add super tags to tagit window
$(".super_tag").click(function(){
var super_tag = $(this).text();
$("#myTags").tagit("createTag", super_tag);
});
});
</script>
This does not answer my question directly, as I could not figure out a way to use Jquery Tagit to do what I wanted.
So I created a custom routine to do this:
Complete Code below with some CSS for tag appearance: