Support

Account

Forum Replies Created

  • Sorry for speaking to myself. I have figured it out. I have done the following. Thanks again for your help @elliot

    <script type="text/javascript">
        
            jQuery(document).on('acf/setup_fields',function(e){
    		      //alert('test');
              jQuery( "#dialog" ).dialog();
    
        		
        	});
    
          </script>
  • Hi @elliot,

    thank you for your answer. I have already read this article, but I don’t reaklly understand it. Do I have to create the acfg/setup_fields action in my wordpress functions.php or directly into my HTML in the create_field function() ?

    My create_field function looks like this now. But it doesn’t work 🙁

    	function create_field( $field )
    	{
    		// defaults?
    		/*
    		$field = array_merge($this->defaults, $field);
    		*/
    
    		// perhaps use $field['preview_size'] to alter the markup?
    
    		// create Field HTML
    		?>
          <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
          
          <script>
            $(document).live('acf/setup_fields', function(e, div){
     
            	// div is the element with new html.
            	// on first load, this is the $('#poststuff')
            	// on adding a repeater row, this is the tr
             
            	$(div).find('.class').each(function(){
             
            		$(this).doIt();
             
            	});
             
            });
            
            function doIt() {
                alert("Hello World!");
            }
          </script>
          <div id="dialog" title="Basic dialog">
            <p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
          </div>
    		<?php
    	}

    Cheers,
    javanese

Viewing 2 posts - 1 through 2 (of 2 total)