😆Attribute Starts With Selector [name^="value"] (ok)

https://api.jquery.com/attribute-starts-with-selector/

C:\xampp82\htdocs\wp3\wp-content\themes\twentytwentyfour\functions.php

function wpdocs_selectively_enqueue_admin_script()
{
	wp_enqueue_script('admin_custom_style', get_stylesheet_directory_uri() . '/assets/js/back-custom.js', array(), '0.1.0', 'all');
}
add_action('admin_enqueue_scripts', 'wpdocs_selectively_enqueue_admin_script');

C:\xampp82\htdocs\wp3\wp-content\themes\twentytwentyfour\assets\js\back-custom.js

jQuery(document).ready(function ($) {
  var valkeywords = $( "input[id^='saswp_medicalwebpage_keywords']" ).val();
  if(!valkeywords) {
    var valname = $( "input[id^='saswp_medicalwebpage_name']" ).val();
    $( "input[id^='saswp_medicalwebpage_keywords']" ).val(valname);
  }
});

Last updated

Navigation

Lionel

@Copyright 2023