Reputation: 682
I am using tagit plugin for tagging and bootstrap for design in my website. I want to show placeholder text in the tagit input field.
Already tried:
$("#input_id").tagit({placeholder: 'placeholder text'})
But, it is not showing "placeholder text" as default text in tagit input field.
Any help will be appreciated.
Thanks!
Upvotes: 0
Views: 1873
Reputation: 969
If you want to show placeholder once use simple:
$("#input_id").tagit({placeholderText: 'Placeholder text'});
or if you want change one dynamic - use:
$("#input_id").data("ui-tagit").tagInput.attr("placeholder", "New placeholder text");
Upvotes: 0
Reputation: 682
Its solved, i was setting the wrong attribute. Instead
$("#input_id").tagit({placeholder: 'placeholder text'})
it should be
$("#input_id").tagit({placeholderText: 'placeholder text'})
Upvotes: 3
Reputation: 32172
HI now you can try to javascript as like this
setAttribute() Method
var rohit = document.getElementById('input_id');
rohit.setAttribute("placeholder", "placeholder text");
<input id="input_id" type="text" >
Upvotes: 0