How to convert case type Select tag to radio button in online case form using javascript.

We can convert ‘Case Type’ select tag to radio button in online case form by using javascript.

<div style="display:block;">
                            <label for="category"></label>
                            <NLCATEGORY>
                            </NLCATEGORY>
                        </div>
$('form #category').each(function(i, select){
    var $select = $(select);
    $select.find('option').each(function(j, option){
        var $option = $(option);
        // Create a radio:
        var $radio = $('<input type="radio" />');
        // Set name and value:
        $radio.attr('name', $select.attr('name')).attr('value', $option.val());
        // Set checked if the option was selected
        if ($option.attr('selected')) $radio.attr('checked', 'checked');
        // Insert radio before select box:
        $select.before($radio);
        // Insert a label:
        $select.before(
          $("<label />").attr('for', $select.attr('name')).text($option.text())
        );
        // Insert a <br />:
        $select.before("<br/>");
    });
    $select.remove();
});
This image has an empty alt attribute; its file name is image-109.png

Leave a comment

Your email address will not be published. Required fields are marked *