title.js 460 B

123456789101112131415161718192021
  1. /**
  2. * @file
  3. * Title attribute functions.
  4. */
  5. (function ($, Drupal, document) {
  6. 'use strict';
  7. var fieldName = '[name="attributes[title]"]';
  8. /**
  9. * Automatically populate the title attribute.
  10. */
  11. $(document).bind('linkit.autocomplete.select', function (triggerEvent, event, ui) {
  12. if (ui.item.hasOwnProperty('title')) {
  13. $('form.linkit-editor-dialog-form').find(fieldName).val(ui.item.title);
  14. }
  15. });
  16. })(jQuery, Drupal, document);