Problem
I have tried to make a link on a pop-up user registration form open in a new browser tab, but it seems to ignore any targeting script added and keep opening the link the same tab.
Additional context:
- The site is based on a Wordpress template
- " " works fine in other area of the site
<div class="form-group">
<label for="register-terms-and-conditions">
<input type="checkbox" name="terms_and_conditions" value="on" id="register-terms-and-conditions" oninvalid="setCustomValidity('Please accept the terms and conditions before proceeding')" oninput="setCustomValidity('')" required>
<?php
echo sprintf(wp_kses(__('I accept the <a href="https://www.google.com" target="_blank" >terms and conditions*</a>'), array('a' => array('href' => array())) ), esc_url($page_url));
?>
</label>
</div>
What I have tried
- I checked the browsers' behavior and tested with Chrome, Safari, Firefox. The results did not change.
- I tried testing other <a target= attributes ("blank", "_parent", "_top" to see if it is simply the problem with triggering the new tab. The results did not change.
- Tried onclick=" ". The result did not change.
echo sprintf(wp_kses(__('I accept the <a onclick="window.open(this.href,'_blank');return false;" href="https://www.google.com" >terms and conditions*</a>'), array('a' => array('href' => array())) ), esc_url($page_url));
1条答案
按热度按时间uemypmqf1#
收到替换echo的建议。target="_blank”现在工作正常