Skip to content

Commit

Permalink
minor refactor to the "customLook" example code in the demos page
Browse files Browse the repository at this point in the history
  • Loading branch information
yairEO committed Jan 18, 2024
1 parent 1e081c1 commit b56b47b
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1643,19 +1643,22 @@ <h3>JAVASCRIPT</h3>
})

var input = document.querySelector('.customLook'),
button = input.nextElementSibling,
tagify = new Tagify(input, {
// email address validation (https://stackoverflow.com/a/46181/104380)
pattern: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
whitelist: randomStringsArr,
callbacks: {
"invalid": onInvalidTag
},
dropdown : {
position: 'text',
enabled: 1 // show suggestions dropdown after 1 typed character
}
}),
button = input.nextElementSibling; // "add new tag" action-button
editTags: {
keepInvalid: false, // better to auto-remove invalid tags which are in edit-mode (on blur)
},
// email address validation (https://stackoverflow.com/a/46181/104380)
pattern: /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,
whitelist: randomStringsArr,
callbacks: {
"invalid": onInvalidTag
},
dropdown : {
position: 'text',
enabled: 1 // show suggestions dropdown after 1 typed character
}
}); // "add new tag" action-button

button.addEventListener("click", onAddButtonClick)

Expand Down

0 comments on commit b56b47b

Please sign in to comment.