Join

Open Button Links in a New Tab

Don't want to mess with code snippets? Request for this to be a feature of MyListing Pro.

Instructions

  1. Create a new JS code snippet.
  2. Copy the contents of code snippet below.
  3. Paste the contents into your code snippet.
  4. Review any notes that I’ve provided.
  5. Save and enable the code snippet.
  6. Test.

Snippet

This ability is important because you don’t want to take people away from your website when visiting an external website.

Customization Notes

This code snippet targets MyListing’s ‘Button 4’ Style (.button-4), so if you want this to target a different button style, be sure to update the snippet accordingly.

jQuery('.button-4').attr('target', '_blank')

Now, the chances of you using that button class (.button-4) throughout other parts of your website are slim, but if you want to ensure you only target the buttons in a particular block, the steps below will help.

  1. Edit the shortcode block we’ve been working with.
  2. Custom Block ID > Add your desired ID (e.g., ‘sellbooks’).
  3. Adjust your code snippet as shown below.
jQuery('#sellbooks .button-4').attr('target', '_blank')