Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery('#tshowcase-dtaxonomy').each(function(i, select){
- var $select = jQuery(select);
- $select.wrap( "<div class='tshowcase_inline_filter'></div>" );
- $select.find('option').each(function(j, option){
- var $option = jQuery(option);
- // Create a radio:
- var $radio = jQuery('<input type="radio" />');
- // Set name and value:
- var thisval = $option.val();
- var thisfor = 'dtaxonomy-'+$option.val();
- if(thisval == '') { thisval = 0; thisfor = 'dtaxonomy-all' }
- $radio.attr('name', $select.attr('name')).attr('value', thisval).attr('id', thisfor);
- // Set checked if the option was selected
- if ($option.attr('selected')) $radio.prop('checked', true);
- // Insert radio before select box:
- $select.before($radio);
- // Insert a label:
- $select.before(
- jQuery("<label />")
- .attr('for', thisfor)
- .text($option.text())
- );
- });
- $select.remove();
- });
Advertisement
Add Comment
Please, Sign In to add comment