Ray Roman
Ray Roman

Reputation: 41

How to make image clickable

<div className="col-lg-3 col-md-3">
    <li>
      <img src='https://i.imgur.com/fe0T4nw.png' onClick="https://arizonaatwork.com" />
    </li>
</div>

In my project I am importing an image and on the onclick I want the image to take them to a URL. How can I get this done?

Upvotes: 4

Views: 25184

Answers (2)

Hardi Shah
Hardi Shah

Reputation: 343

Working example: You need to add "a" tag before image

<div className="col-lg-3 col-md-3">
<li>
  <a href="https://i.imgur.com/fe0T4nw.png"><img src='https://i.imgur.com/fe0T4nw.png' onClick="https://arizonaatwork.com" /></a>
</li>

Upvotes: 0

Eyzi
Eyzi

Reputation: 516

You can use a tag:

<li><a href='https://arizonaatwork.com'><img src='https://i.imgur.com/fe0T4nw.png'/></a></li>

Upvotes: 5

Related Questions