• Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.
    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

HTML html help with button code

aj nas

New Coder
I have a button code that looks like this. I want the link to open in a new tab when pressing the button. I can't seem to modify the code to do that. Can someone help.
This is the code:
<input _blank="" onclick="window.location.href='https://checkout.square.site/buy/VBTRXPKD2OXCMA2FQD3RMRRR'" type="button" value="Resume and cover letter" /></div><div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal;"><div style="font-size: 100%;"><form></form></div><div style="font-size: 100%;"></div>
 
Solution
Tested and works

"window.open('https:\/\/checkout.square.site/buy/VBTRXPKD2OXCMA2FQD3RMRRR', '_blank')"

Put this instead of your window.location.href(), and delete that _blank=""

darioK

New Coder
Why dont you use anchor tag and make it look like a button?

HTML:
<a href='https://checkout.square.site/buy/VBTRXPKD2OXCMA2FQD3RMRRR' target="_blank" class="button">Resume and cover letter"</a>

Now use .button in css to style it to look like a button.
 

aj nas

New Coder
I can't I'm using it on blogger to promote tutoring services. It does not enabled for coding. So I had to use and html code for a button. But the button does not open a new page. I prefer if it opened a new tab when clicked.
 

Malcolm

Administrator
Administrator
Verified
I have a button code that looks like this. I want the link to open in a new tab when pressing the button. I can't seem to modify the code to do that. Can someone help.
This is the code:
<input _blank="" onclick="window.location.href='https://checkout.square.site/buy/VBTRXPKD2OXCMA2FQD3RMRRR'" type="button" value="Resume and cover letter" /></div><div style="font-family: Georgia, serif; font-size: 100%; font-style: normal; font-variant-caps: normal; font-variant-ligatures: normal; font-weight: normal;"><div style="font-size: 100%;"><form></form></div><div style="font-size: 100%;"></div>
Hi there,

Welcome to Code Forum!

Please add your code into our Code BBCode feature. To learn more about how to use our BBCode feature, please click here.

I’ll help you soon! Just need my laptop.
 

darioK

New Coder
Tested and works

"window.open('https:\/\/checkout.square.site/buy/VBTRXPKD2OXCMA2FQD3RMRRR', '_blank')"

Put this instead of your window.location.href(), and delete that _blank=""
 
Solution
Top Bottom