开发者

how to create radio button with images

开发者 https://www.devze.com 2023-03-28 08:46 出处:网络
I want to have a radio button with images instead of text. So I want to have an image of male and female instead of a text of male and female. Can this actually be done using a standard HTML or do I h

I want to have a radio button with images instead of text. So I want to have an image of male and female instead of a text of male and female. Can this actually be done using a standard HTML or do I have to use jQue开发者_StackOverflow中文版ry? How do I do this?


Use <label> elements to host your images, like this:

<input type="radio" name="sex" value="male" id="male-radio">
<label for="male-radio"><img src="male.gif"></label>

<input type="radio" name="sex" value="female" id="female-radio">
<label for="female-radio"><img src="female.gif"></label>

Working example: http://jsfiddle.net/RichieHindle/vQwCF/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号