Jquery当if元素有文本时,尝试附加到选项选项卡

时间:2023-02-15 19:53:03
<script type="text/javascript">// <![CDATA[
$(document).ready(function() {
               if ($('.shopping_product > div.shopping_product:contains("Treasure Garden")').length > 0)
                {
                    $('<iframe />');  // Create an iframe element
                    $('<iframe />', {
                        name: 'frame1',
                        id: 'frame1',
                        width:'100%',
                        height:'792px',

                        src: 'http://www.shopthegreatescape.com/_wss/clients/20/assets/care%20and%20maintenance.pdf'
                    }).appendTo('#product_tab_extdesc0');
                });
            });
// ]]></script>

1 个解决方案

#1


0  

This will be the condition

这将是条件

if($('div.shopping_product:contains("Treasure Garden")').html().length > 0) {

}

#1


0  

This will be the condition

这将是条件

if($('div.shopping_product:contains("Treasure Garden")').html().length > 0) {

}