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

Using Javascript on css3 forms

Using Javascript on css3 forms

Problem

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

JAVASCRIPT

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

$("document").ready(function(){
    $(".class").css("width",imageWidth);
    $(".class").css("height",imageHeight);
});

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

CSS

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

(more on this css technique at www.suburban-glory.com/blog?page=140)

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

Solution

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

Discussion

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

×