Title: Radio buttons in Form
Post by: poeziafree on September 02, 2022, 11:42:30 PM
Hello,
How can I achieve this type of radio buttons in form (see the attached image)? There is a label on the left and within this label there are multiple radio buttons each having its own label.
Title: Re: Radio buttons in Form
Post by: jarry on September 04, 2022, 06:25:24 AM
Please refer to the code below: <!DOCTYPE html> <html>
<head> <meta charset="UTF-8"> <title>Basic RadioButton - jQuery EasyUI Demo</title> <link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="https://www.jeasyui.com/easyui/themes/icon.css"> <script type="text/javascript" src="https://www.jeasyui.com/easyui/jquery.min.js"></script> <script type="text/javascript" src="https://www.jeasyui.com/easyui/jquery.easyui.min.js"></script> </head>
<body> <form id="ff"> <div class="f-row" style="margin-bottom: 10px;"> <div style="width: 100px;">Size:</div> <div class="f-row"> <div style="width: 100px;"> <input class="easyui-radiobutton" name="size" value="M" label="M" labelPosition="after" labelWidth="30"> </div> <div style="width: 100px;"> <input class="easyui-radiobutton" name="size" value="L" label="L" labelPosition="after" labelWidth="30"> </div> <div style="width: 100px;"> <input class="easyui-radiobutton" name="size" value="XL" label="XL" labelPosition="after" labelWidth="30"> </div> </div> </div> <div class="f-row"> <div style="width: 100px;">Color:</div> <div class="f-row"> <div style="width: 100px;"> <input class="easyui-radiobutton" name="color" value="blue" label="Blue" labelPosition="after" labelWidth="50"> </div> <div style="width: 100px;"> <input class="easyui-radiobutton" name="color" value="grey" label="Grey" labelPosition="after" labelWidth="50"> </div> <div style="width: 100px;"> <input class="easyui-radiobutton" name="color" value="XblackL" label="Black" labelPosition="after" labelWidth="50"> </div> </div> </div> </form> </body>
</html>
Title: Re: Radio buttons in Form
Post by: poeziafree on September 04, 2022, 09:08:20 PM
Hello, Jarry
Thank you, but I don't use HTML structure to create a form.
I use js code for constructing form elements.
How can I achieve this through javascript?
Can we extend radio button component so that it support multiple radio buttons within one label and with each radio button having its own text?
|