html - How can i use same id for more than one radio buttons? -
this code using on page
<ul class="tabs"> <li> <input type="radio" name="tabs" id="som" value="0"> <label for="som">venta</label> </li> <li> <input type="radio" name="tabs" id="som" value="1"> <label for="som">aliquera</label> </li>
css
.tabs input[type=radio] { position: absolute; top: -9999px; left: -9999px; } .tabs { width: 95%; float: none; list-style: none; position: relative; padding: 0; margin: 0px auto; } .tabs li{ float: left; border:1px solid #006699; border-radius:10px 10px 0 0; border-bottom:none; width:31%; background-color:#edf6fa; } .tabs label { display: block; padding: 10px 10px; border-radius: 10px 10px 0 0; color: #08c; cursor: pointer; position: relative; -webkit-transition: 0.2s ease-in-out; -moz-transition: 0.2s ease-in-out; -o-transition: 0.2s ease-in-out; transition: 0.2s ease-in-out; } .tabs label:hover { background: rgba(255,255,255,0.5); }
the above code works when use different id each input type="radio"
(example if use id="som2"
, <label for="som2">
in second <li>
works checked attribute) want work when id's same please me in this.
the link when use different id's:http://jsfiddle.net/3ptjf/.
but want work link:using same id's when use same id's
how can use same id more 1 radio buttons?
by convention, id unique identificator - it has unique within whole page. in other words, 1 id per 1 element 2 elements shouldn't, couldn't, musn't have same id.
you can check these threads more information:
note: if want use same style(s) more elements, consider usage of classes instead of ids.
Comments
Post a Comment