Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery('[id^=_aditional_info_custom_boolean]').each(function(i, select){
- var select = jQuery(this);
- select.find('option').each(function(j, option){
- if (j > 0) {
- var option = jQuery(this);
- // Create a radio:
- var radio = jQuery('<input type="radio" />');
- // Set name and value:
- radio.attr('name', select.attr('name')).attr('id', select.attr('name')+j).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(
- jQuery("<label />").attr('for', select.attr('name')+j).text(option.text())
- );
- // Insert a \n:
- // select.before("<br/>");
- }});
- select.remove();
- });
Advertisement
Add Comment
Please, Sign In to add comment