DreamWave
DreamWave

Reputation: 1940

JqueryMobile replace radio button with image

I'm creating a radio group for a web app with jquerymobile. At one point the user must choose between "male" and "female". I have images for a clicked(touched) gender and an unclicked one. I want to replace the radio group with two images that have two states. How do I do that?

Upvotes: 1

Views: 1859

Answers (1)

Gajotres
Gajotres

Reputation: 57309

I made you an example here: http://jsfiddle.net/Gajotres/EeRXd/

$('div[data-role="fieldcontain"] fieldset  div div:first-child label span span').html('<img src="http://cdn1.iconfinder.com/data/icons/Snow/Snow/snow/Male.png" width="32px" height="32px"></img>');
$('div[data-role="fieldcontain"] fieldset  div div:last-child label span span').html('<img src="http://cdn1.iconfinder.com/data/icons/Snow/Snow/snow/Female.png" width="32px" height="32px"></img>');

If you want something else please tell me in comment, also if you have an image for every state send me a location and I will rebuild you this example.

Upvotes: 3

Related Questions