Hi I have a HTML button that is setup like this:
<input type="image" src="derp.png">
As the image is not assigned via CSS how am I meant to change it on hover?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Something like the following would work (though currently untested), it requires the alternate image to be stored in a custome
data-*attribute in order that the script knows where to find it, and then stores the originalsrcin a similardata-*in order to put it back on mouseout:JS Fiddle demo.
Bear in mind the above requires your
inputto have the HTML form:Edited to add a CSS option, which is somewhat imperfect unfortunately, and requires that the
inputhas no image set in itssrcattribute:JS Fiddle demo.