jQuery: make checkboxes act like radio buttons?

后端 未结 11 1615
栀梦
栀梦 2020-11-28 10:29

Is there a way to make checkboxes act like radio buttons? I assume this could be done with jQuery?



        
11条回答
  •  清酒与你
    2020-11-28 11:12

    Perhaps you want to consider a different approach. I believe you want to style the radio button to look like a checkbox. If so, see: this google search

    And below is a simplified example that I borrow from www.thecssninja.com.

    To put it simply: you hide the actual radio button (see the css input[type=radio]) and you style the label for the corresponding radio button to show the custom checkbox (from the css sprite in the background image in input[type=radio] + label) and switch to a different sprite in the background when the radio button is in checked state. Running example here: http://jsfiddle.net/jchandra/R5LEe/

         
         
         
           
           Custom CSS3 control facade       
                 
         
         
          Custom control images and concept from www.thecssninja.com


提交回复
热议问题