TypeError: $(…).dialog is not a function
-
Hello,
I try to open a pdf file on a dialog with jQuery with a click function on a link. But I have this error : TypeError: $(…).dialog is not a function.
I looked for in all forums but I have still this error. I’m just a beginner with jQuery.
Here is my code :
wp_register_script('jquery-ui', get_template_directory_uri() . '/js/jquery-ui.js', array('jquery'), '1.0.0'); // Custom scripts wp_enqueue_script('jquery-ui'); // Enqueue it! wp_register_script('jquery-ui-min', get_template_directory_uri() . '/js/jquery-ui.min.js', array('jquery'), '1.0.0'); // Custom scripts wp_enqueue_script('jquery-ui-min'); // Enqueue it!<script language="javascript" type="text/javascript"> $(document).ready(function() { var dialogPdf = $("#dialog").dialog({ autoOpen: false }); $('#trigger').click(function(e){ dialogPdf.dialog('open'); return false; }); }); </script><div id="dialog" class="dialog" style="display:none"> <?php $file = get_field('livret_pdf'); if( $file ): ?> <div> <iframe src="<?php echo $file['url']; ?>"></iframe> </div> <?php endif; ?> </div>When I put dialog on display: block or other, I can see the pdf perfectly. It’s a jquery problem.
Thanks for your help,
Milene
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
The topic ‘TypeError: $(…).dialog is not a function’ is closed to new replies.