jQuery更改包含快捷码的href

jQuery更改包含快捷码的href,jquery,wordpress,Jquery,Wordpress,当我单击包含短代码的链接时,我想通过删除任何空格来更改href。这是链接 <div class='strip_space'> <a href="https://example.com/[wpbb site:user_meta key='contrib-name']">Testing</a> </div> 我错过了什么 干杯,Richard 下面是我用于排队的代码片段 function my_scripts_method() { wp

当我单击包含短代码的链接时,我想通过删除任何空格来更改href。这是链接

<div class='strip_space'>
   <a href="https://example.com/[wpbb site:user_meta key='contrib-name']">Testing</a>
</div>
我错过了什么

干杯,Richard

下面是我用于排队的代码片段

function my_scripts_method() {
    wp_enqueue_script(
        'strip-space', // name your script so that you can attach other scripts and de-register, etc.
        get_stylesheet_directory_uri() . '/js/strip-space.js',
        array('jquery') // this array lists the scripts upon which your script depends
    );
  }
add_action('wp_enqueue_scripts', 'my_scripts_method');
您可以使用
它可以工作!我对海狸建造者一无所知
function my_scripts_method() {
    wp_enqueue_script(
        'strip-space', // name your script so that you can attach other scripts and de-register, etc.
        get_stylesheet_directory_uri() . '/js/strip-space.js',
        array('jquery') // this array lists the scripts upon which your script depends
    );
  }
add_action('wp_enqueue_scripts', 'my_scripts_method');