Create the module.libraries.yml at-story: js: js/at-story.js: {} dependencies: - core/jquery - core/jquery.once - core/drupalSettings File : at-story.js Drupal.behaviors.atjs = { attach: function (context, drupalSettings) { if (drupalSettings.at_story.node_published == false) {//not published if (drupalSettings.at_story.node_type == 'story') { $('#edit-title-0-value', context).keyup(function () { var long_h = $(this).val(); $('#edit-field-story-short-headline-0-value').val(long_h); $('#edit-field-app-headline-0-value').val(long_h); }); } } } }; module file where we load the file and varibales : .module file if($form_id == 'node_story_edit_form' || $form_id == 'node_video_edit_form' || $form_id == 'node_photo_gallery_edit_form...
Trying to Learn new things on drupal.