0

I have some text which I'd like to be clickable. And I want the picture to be opened when I click the certain word in a new window (not in a new tab). How could I do that? The code below does not work.

<p>Click on the <a href = "./images/TheForm.jpg">"Request Access"</a> button and fill in the form.</p>
Anthony
  • 73
  • 5

3 Answers3

0

Just add a target="_blank" to your link if you want to open the destination of a link in a new tab:

<a href = "./images/TheForm.jpg" target="_blank">Request Access</a>

And define a onClick method to open it in a window :

<a href="./images/TheForm.jpg"  
    onclick="window.open('./images/TheForm.jpg', 
                         'windowName', 
                         'width=800, height=600'); 
              return false;"
 >Request Access</a>

When you specify the width/height, it'll open the link in a new window instead of a tab.

Here is the documentation for further information.

0
<a href="IMAGE_URL" target="_blank">
  <img alt='img_path' class='img-40 rounded-circle' src='IMAGE_URL' />
</a>
Amr yasser
  • 408
  • 5
  • 10
  • I don't wanna make a link from the pic. I wanna click on the text and open the pic in a new window(not tab). – Anthony Jan 04 '22 at 13:51
  • then you will need to use target="_blank" and the new tab is a new window what is the difference between tab and window? – Amr yasser Jan 04 '22 at 14:26
0

It's for react: import CardImageOne from './Images/card-image-1.jpg' //Image source//

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 31 '23 at 19:26