Make the mouse pointer a hand to press the button

<td id="btnIcOld" style="text-align:center;"> <img src="<%= VirtualPathUtility.ToAbsolute("~/img/chic/Load.png")%>" /> </td> $('#btnIcOld').live('click', function () { window.location.href = 'https://extranetint.chathamfinancial.com/indications/swapcalculator'; }); 

So, as you can see above, the image is my button, and this is jQuery that handles the button click. The problem is that when you hover over the image, it remains the main arrow pointer. How can I change it manually so that the user knows that he can click on it?

+8
jquery
source share
4 answers

You can change your style for the cursor:pointer column cursor:pointer see CSS Cursor Property .

 <td id="btnIcOld" style="text-align:center;cursor:pointer;"> <img src="<%= VirtualPathUtility.ToAbsolute("~/img/chic/Load.png")%>" /> </td> 
+15
source share

You can use cursor:pointer in your CSS style. See some CSS cursors here.

Alternatively, there is no way to wrap it with a tag, pointing to the desired link?

+1
source share

Change the cursor style if above the image:

 <td id="btnIcOld" style="text-align:center;"> <img style="cursor: pointer" src="<%= VirtualPathUtility.ToAbsolute("~/img/chic/Load.png")%>" /> </td> 
+1
source share

Everyone is very right, but I would recommend separating these styles for ease of maintenance. Try something like this:

main.css:

 .txtCenter { text-align:center; } .clickImage { cursor:pointer; } 

ASPX page:

 <html> <head> ... <link rel="stylesheet" href="path\to\main.css" type="text/css" /> </head> <body> ... <td id="btnIcOld" class="txtCenter"> <img class="clickImage" src="<%= VirtualPathUtility.ToAbsolute("~/img/chic/Load.png")%>" /> </td> ... </body> </html> 
0
source share

Source: https://habr.com/ru/post/650805/


All Articles