Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Using Javascript on css3 forms

Using Javascript on css3 forms


Using a JavaScript+jQuery I am manipulating image widths as so:


var imageWidth = .9 * $(window).innerWidth();
var imageHeight = .6 * $(window).innerWidth();


But I also am using this to give my submit button a PHP robust image


 form input[type=submit]{
     background: url("xyz.png") no-repeat center center;
     width: 90px;
     height: 60px;
     border: none;
     color: transparent;

(more on this css technique at

My question is not very difficult but I can't find the information I need. How do I call the form input [type=submit] in JavaScript so I can manipulate the image used for the submit button? (as you can see in the examples I was simply calling CSS classes)

Problem courtesy of: Gamemorize


$('form input[type="submit"]').css('background-image', 'url("xyz.png")');
Solution courtesy of: Kir Ubuntu


View additional discussion.

This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

Using Javascript on css3 forms


Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription