无法在jQuery PHP WORDPRESS中附加HTML结构 jQuery(函数($){ $(“td”).filter(函数(){ 返回$(this).text()=''; }).css({'background color':'Green'}); $(“td”).filter(函数(){ 返回$(this).text()=''; }).append(“ 萨拉姆 萨拉姆 "); });

无法在jQuery PHP WORDPRESS中附加HTML结构 jQuery(函数($){ $(“td”).filter(函数(){ 返回$(this).text()=''; }).css({'background color':'Green'}); $(“td”).filter(函数(){ 返回$(this).text()=''; }).append(“ 萨拉姆 萨拉姆 "); });,php,jquery,wordpress,Php,Jquery,Wordpress,如果双引号有问题,则需要对其进行转义或使用单引号来包装html: <script type="text/javascript"> jQuery(function($) { $("td").filter(function (){ return $(this).text() == '<?php echo $eventDate ?>'; }).css({ 'background-color': 'Green' }); $("td")

如果双引号有问题,则需要对其进行转义或使用单引号来包装html:

<script type="text/javascript">
jQuery(function($) {

    $("td").filter(function (){
        return $(this).text() == '<?php echo $eventDate ?>';
    }).css({ 'background-color': 'Green' });


    $("td").filter(function (){
        return $(this).text() == '<?php echo $eventDate ?>';
    }).append("
    <div id="myCard" class="flip-container" >
        <div class="flipper">
            <div class="front">
                <!-- front content -->
                salam
            </div>
            <div class="back">
                <!-- back content -->
                salam
            </div>
        </div>
    </div>");


});
</script>
$(“td”).filter(函数(){
返回$(this).text()='';
}).append('
萨拉姆
萨拉姆
');
此外,不能像javascript中那样使用多行(上面的示例只是为了说明引号)

我会在您使用jquery时在jquery中构建dom,但您也可以转义新行,然后组合结果将是:

$("td").filter(function (){
    return $(this).text() == '<?php echo $eventDate ?>';
}).append('
<div id="myCard" class="flip-container" >
    <div class="flipper">
        <div class="front">
            <!-- front content -->
            salam
        </div>
        <div class="back">
            <!-- back content -->
            salam
        </div>
    </div>
</div>');
$(“td”).filter(函数(){
返回$(this).text()='';
}).append('\
\
\
\
萨拉姆\
\
\
\
萨拉姆\
\
\
');

如果双引号有问题,则需要对其进行转义或使用单引号来包装html:

<script type="text/javascript">
jQuery(function($) {

    $("td").filter(function (){
        return $(this).text() == '<?php echo $eventDate ?>';
    }).css({ 'background-color': 'Green' });


    $("td").filter(function (){
        return $(this).text() == '<?php echo $eventDate ?>';
    }).append("
    <div id="myCard" class="flip-container" >
        <div class="flipper">
            <div class="front">
                <!-- front content -->
                salam
            </div>
            <div class="back">
                <!-- back content -->
                salam
            </div>
        </div>
    </div>");


});
</script>
$(“td”).filter(函数(){
返回$(this).text()='';
}).append('
萨拉姆
萨拉姆
');
此外,不能像javascript中那样使用多行(上面的示例只是为了说明引号)

我会在您使用jquery时在jquery中构建dom,但您也可以转义新行,然后组合结果将是:

$("td").filter(function (){
    return $(this).text() == '<?php echo $eventDate ?>';
}).append('
<div id="myCard" class="flip-container" >
    <div class="flipper">
        <div class="front">
            <!-- front content -->
            salam
        </div>
        <div class="back">
            <!-- back content -->
            salam
        </div>
    </div>
</div>');
$(“td”).filter(函数(){
返回$(this).text()='';
}).append('\
\
\
\
萨拉姆\
\
\
\
萨拉姆\
\
\
');

在JavaScript中不能使用这样的字符串多行。在这里检查语法是否有效。谢谢你的朋友:)那么我如何添加这个元素呢?你不能在JavaScript中使用这样的字符串多行。在这里检查语法是否有效。谢谢你的朋友:)那么我怎样才能添加这个元素呢?谢谢你Jeroen。这节省了我很多时间。:)谢谢你,杰伦。这节省了我很多时间。:)