Reputation: 33
How can I include radio button or checkbox inside the table?
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
</head>
<body>
<table>
<thead><th>radio button</thead>
<tbody><tr><td><input type="radio" value="r1"></td></tr></tbody>
</table>
</body>
</html>
Upvotes: 2
Views: 963
Reputation: 680
Add the radio button as per the guidelines in materializecss. You can add the empty span if you don't need any label text.
<label>
<input type="radio" />
<span>label text</span>
</label>
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
</head>
<body>
<table>
<thead><th>radio button</thead>
<tbody><tr><td><label>
<input type="radio" />
<span></span>
</label></td></tr></tbody>
</table>
</body>
</html>
Upvotes: 0
Reputation: 16251
As in F12 opacity:0
what means your radio is invisible:
As materialize doc you have to use radio
as below with class="with-gap"
:
<p>
<label>
<input class="with-gap" name="yourName" type="radio"/>
<span>yout text</span>
</label>
</p>
See working code
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
</head>
<body>
<table>
<thead>
<th>radio button</thead>
<tbody>
<tr>
<td>
<p>
<label>
<input class="with-gap" name="group3" type="radio" />
<span>Red</span>
</label>
</p>
</td>
</tr>
</tbody>
</table>
</body>
</html>
Upvotes: 3