How to display image in place of checkbox?

I want to display green checked image when checkbox is checked and when not checked empty box. I tried to put checkbox in div and set div's background but it is not helping me out. Any idea what to do? Below is the output I want.

Answers


Like this with little jQuery and css: DEMO

<div class="checkbox">
</div>

.checkbox{
   width: 23px;
   height: 21px;
   background: transparent url(http://i.stack.imgur.com/S4p2R.png ) no-repeat 0 50%
}
.checked{
   background: transparent url(http://i.stack.imgur.com/S4p2R.png ) no-repeat 80% 50%
}

$(".checkbox").click(function(){
    $(this).toggleClass('checked')
});

Need Your Help

UIImageView Memory Problem

iphone objective-c memory uiimageview

I have a UIImageView property in my view controller set to "assign". Every time I hit a button, I set the image in the view to something new. Due to the way I am using another component, I have to

2 class style declaration in css doesn't work

css class

I want to use CSS to style two different inputs, but in my CSS file use only one declaration for both classes. Here is what I tried

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.