Web Applications in Bournemouth & Front End Development in Bournemouth

Celebrating 15 years of design and development

Change the cursor with jQuery

Due to the fact that it is not valid css to change the cursor, we had to find an alternative way of achieving this. For the Intunet site itself, it was not very usable for the cursor not to change when it went over the search button. It gives you that extra bit of confidence that the button actually does something.

To get over this issue we wrote the following snippet of jQuery:

$('#searchform  button').hover(function() {
 $(this).css('cursor','pointer');
 }, function() {
 $(this).css('cursor','auto');
});

Even though this is a relatively small bit of code, the importance of details like this cannot be overstated. Usability of important tools like the search box can be the difference between people staying on your site, or going elsewhere to find the information they need.

Yes, this can be done using css, but the css is invalid under xhtml strict rules. This way, you won’t step on anyone toes and your site will work perfectly.


Leave a Reply


Get in Touch

If you would like information on any of our services, with no obligation, call us on:

0800 180 4566