Skip to content

Commit

Permalink
added "readonly" to be able to be configured from the settings and no…
Browse files Browse the repository at this point in the history
…t only as an attribute on the original input
  • Loading branch information
Yair Even Or authored and Yair Even Or committed Feb 5, 2022
1 parent 45b2a8a commit f3ad3a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tagify.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Tagify.prototype = {
var _s = this.settings = extend({}, DEFAULTS, settings)

_s.disabled = input.hasAttribute('disabled')
_s.readonly = input.hasAttribute('readonly') // if "readonly" do not include an "input" element inside the Tags component
_s.readonly = _s.readonly || input.hasAttribute('readonly')
_s.placeholder = input.getAttribute('placeholder') || _s.placeholder || ""
_s.required = input.hasAttribute('required')

Expand Down Expand Up @@ -960,7 +960,7 @@ Tagify.prototype = {
setReadonly( toggle, attrribute ){
var _s = this.settings

document.activeElement.blur() // exists possible edit-mode
document.activeElement.blur() // exit possible edit-mode
_s[attrribute || 'readonly'] = toggle
this.DOM.scope[(toggle ? 'set' : 'remove') + 'Attribute'](attrribute || 'readonly', true)

Expand Down

0 comments on commit f3ad3a6

Please sign in to comment.