PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Move Descriptions Above Checkbox?

  1. I found this code in another post on the board, which moves the descriptions above the field for all field types:

    <script type="text/javascript">
    	jQuery(document).ready(function() {
    
    		jQuery('.gfield_description').each(function(i,e){
    		    fielddesc = jQuery('<div>').append(jQuery(e).clone()).remove().html();
    		    jQuery(e).siblings('label.gfield_label').after(fielddesc);
    		    jQuery(e).remove();
    		});
    
    	});
    </script>

    I need to do this but for ONLY the checkbox field type.

    Is this possible?
    Thanks!

    Posted 10 years ago on Monday March 19, 2012 | Permalink
  2. How about trying something like this.. add a class name to the checkbox fields in the admin "move_desc" then you would use inheritance from that new class name to target the appropriate description and move it.

    [js]
    jQuery(document).ready(function() {
    
    		jQuery('li.gfield.move_desc .gfield_description').each(function(i,e){
    		    fielddesc = jQuery('<div>').append(jQuery(e).clone()).remove().html();
    		    jQuery(e).siblings('label.gfield_label').after(fielddesc);
    		    jQuery(e).remove();
    		});
    
    	});

    then you can apply that class name to any field where you want to move the description.

    Posted 10 years ago on Monday March 19, 2012 | Permalink
  3. Kevin,
    That worked GREAT!
    One question that isn't really related (I can start another thread if you want, just say so) -

    I want to display ordered lists (ol) in a list-style-type of decimal for descriptions on a checkbox field (I'm putting in lengthy terms for a contract, and need a list). I've tried several CSS overrides, but can't seem to over power the GF css for lists.
    Any words of wisdom on how to do it?

    You are AWESOME! :)

    Posted 10 years ago on Monday March 19, 2012 | Permalink
  4. Super. Glad that worked for you.

    Yeah, if you will please just start a new topic to keep things tidier for folks searching later. Also, it would help if you can post a URL to your form so I can eyeball it and test. Thanks.

    Posted 10 years ago on Monday March 19, 2012 | Permalink

This topic has been resolved and has been closed to new replies.