好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

CSS多选框样式问题!_html/css_WEB-ITnose

这种多选样式怎么实现?

要保证选中后再次点击能取消,还有后台能获得相应的ID。




回复讨论(解决方案)

点击增加/取消选中样式
获取选中的项拼接起来发送到后台,格式自定义

表面做成一个div的样子,其实隐藏一个checkbox,点div时改变样式,同时改变checkbox的值为选中状态。
下面给出一个例子:

     无标题文档    	.chk{height:22px; background:#f6f6f6;float:left; margin-left:5px; line-height:22px; vertical-align:middle;overflow:hidden; text-align:center;padding:0px 10px 0px 10px;border:1px solid #C99;font-size:12px;cursor:pointer}	.act{color:#F96;background:#fff;}	.chk input{ visibility:hidden; margin-left:-12px;}      $(function(){	$(".chk").click(function(){		if($(this).find("input[name='checkbox']").attr("checked")!="checked"){			$(this).addClass("act");			$(this).find("input[name='checkbox']").attr("checked","checked");		}else{			$(this).removeClass("act");			$(this).find("input[name='checkbox']").removeAttr("checked");			}	})	})  

查看更多关于CSS多选框样式问题!_html/css_WEB-ITnose的详细内容...

  阅读:47次