Custom Radio Div / Images / Buttons

I want the functionality of a switch, but have the ability to choose based on the image. For example, I will have a label (Payment Methods). I would like to create different DIV / Images with each payment accepted (Credit / Card, PayPal, Western Union, etc.). Instead of choosing a small radio button with a small circle, most likely they just click on the image and have a border or change the image to indicate that this method is selected.

It would be even better if I had such functionality with a DIV element, so I can add only what I want in the DIV (text, images, etc.), and the DIV has some kind of border that appears when choosing.

Is this possible using input type = radio? If this is not possible with the help of radio stations, than how do you propose to implement this? If this was done, link :)

+3
source share
1 answer

It is not possible to directly set a checkbox or switch, however, what I do in these situations, I create my own checkbox using jQuery, and based on the user’s choice, I do one of two tigers:

1) Change the value of the hidden field,

2) Change the value of the flag that exists, but it is not displayed to the user, so display: none; will be applied to it.

, div , , 15px high 15px wide, click jQuery. , , , , , .

?

: http://www.filamentgroup.com/lab/accessible_custom_designed_checkbox_radio_button_inputs_styled_css_jquery/

, , : http://plugins.jquery.com/taxonomy/term/1360

+2

Source: https://habr.com/ru/post/1760095/


All Articles