ponepaste/assets/app.js
aftercase 5b2e3d5177 Initial commit
Initial commit
2021-07-10 19:18:17 +01:00

15 lines
No EOL
525 B
JavaScript

$(function() {
$('input, select').on('change', function(event) {
var $element = $(event.target),
$container = $element.closest('.example');
if (!$element.data('tagsinput'))
return;
var val = $element.val();
if (val === null)
val = "null";
$('code', $('pre.val', $container)).html( ($.isArray(val) ? JSON.stringify(val) : "\"" + val.replace('"', '\\"') + "\"") );
$('code', $('pre.items', $container)).html(JSON.stringify($element.tagsinput('items')));
}).trigger('change');
});