通过脚本在一个页面上向动态对象添加静态附加p标记

时间:2017-05-08 16:16:59

标签: javascript jquery

https://www.baptistjax.com/services/brain-and-spine/stroke-and-cerebrovascular-care"这是我在侧栏googlemap中根据电话号码信息添加脚本的页面"

<script>
$("#sidebar div.find-tabs ul li .block.marginB5").append("<p>International Patients:<br />904.399.6518 (ext 164)</p>");
</script>

好的,这最终正常工作!它直接在动态对象中的最后一个对象之后插入附加副本,以便外部容器div边界随着添加而扩展。

3 个答案:

答案 0 :(得分:1)

.append()缺少一个开场报价"

$("#sidebar div.find-tabs ul li .block.marginB5").append(:international Patients:<br />904.399.6518 (ext 164)</p>");

应该是

$("#sidebar div.find-tabs ul li .block.marginB5").append(":international Patients:<br />904.399.6518 (ext 164)</p>");

答案 1 :(得分:1)

你在追加上缺少双引号,它应该是

REPLACE INTO `ra_fd` (`Rposid`, `Nr`, `Room`, `Name`, `Receipt`, `InvoiceID`, `InvoiceArt`, `Done`, `Form_of_paymentID`, `DoneAt`, `Tax`, `Canceled`, `Stay`, `AccountType`, `SKN`, `BillingGrp`, `GROSS0%`, `GROSS7%`, `GROSS19%`, `Cash`, `Voucher`, `Cashless`, `Credit`, `ADV_PAY0%`, `Advance_payment`, `Checked*`)
SELECT gip.`InvoicePositionID` AS Rposid,
       1 AS `Nr`,
       gob.`Roomnumber` AS Room,
       CONCAT (gp.`Surname`,', ',gp.`Prename`) AS Name,
       CONCAT(`Invoicenumber`,' | ',gi.`BookingID`) AS `Receipt`,
       gip.`InvoiceID`,
       `InvoiceArt`,
       `Done`,
       `Form_of_paymentID`,
       `DoneAt`,
       gip.`Tax`,
       `Canceled`,
       DATEDIFF(`DateTo`,`DateFrom`) AS `Stay`,
       gip.`AccountType` AS `AccountType`,
       gip.`SKN` AS `SKN`,
       "Advance_payment" AS `BillingGrp`,
       FORMAT(0,2) AS `GROSS0%`,
       FORMAT(0,2) AS `GROSS7%`,
       FORMAT(0,2) AS `GROSS19%`,
       IF(gi.`Form_of_paymentID` IN (2), IFNULL(IF(gip.`AccountType`= 2,FORMAT((((gip.`Price`)*(100+gip.`Discount`)/100*(100+gip.`Tax`)/100)* DATEDIFF(`DateTo`,`DateFrom`) * gip.`Amount`),2),FORMAT((((gip.`Price`)*(100+gip.`Discount`)/100*(100+gip.`Tax`)/100) * gip.`Amount`),2)),FORMAT(0,2)),FORMAT(0,2)) AS `Cash`,
       IF(gi.`Form_of_paymentID` IN (11),IFNULL(IF(gip.`AccountType`=2,FORMAT((((gip.`Price`)*(100+gip.`Discount`)/100*(100+gip.`Tax`)/100)* DATEDIFF(`DateTo`,`DateFrom`) * gip.`Amount`),2),FORMAT((((gip.`Price`)*(100+gip.`Discount`)/100*(100+gip.`Tax`)/100) * gip.`Amount`),2)),FORMAT(0,2)),FORMAT(0,2)) AS `Voucher`,
       IF(gi.`Form_of_paymentID` IN (5,6,8),IFNULL(IF(gip.`AccountType`= 2,FORMAT((((gip.`Price`)*(100+gip.`Discount`)/100*(100+gip.`Tax`)/100)* DATEDIFF(`DateTo`,`DateFrom`) * gip.`Amount`),2),FORMAT((((gip.`Price`)*(100+gip.`Discount`)/100*(100+gip.`Tax`)/100) * gip.`Amount`),2)),FORMAT(0,2)),FORMAT(0,2)) AS `Cashless`,
       IF(gi.`Form_of_paymentID` IN (9),IFNULL(IF(gip.`AccountType`= 2,FORMAT((((gip.`Price`)*(100+gip.`Discount`)/100*(100+gip.`Tax`)/100)* DATEDIFF(`DateTo`,`DateFrom`) * gip.`Amount`),2),FORMAT((((gip.`Price`)*(100+gip.`Discount`)/100*(100+gip.`Tax`)/100) * gip.`Amount`),2)),FORMAT(0,2)),FORMAT(0,2)) AS `Credit`,
       IF(gip.`SKN` = 'AP',IFNULL(IF(gip.`AccountType`= 2,FORMAT((((gip.`Price`)*(100+gip.`Discount`)/100*(100+gip.`Tax`)/100)* DATEDIFF(`DateTo`,`DateFrom`) * gip.`Amount`),2),FORMAT((((gip.`Price`)*(100+gip.`Discount`)/100*(100+gip.`Tax`)/100) * gip.`Amount`),2)),FORMAT(0,2)),FORMAT(0,2)) AS `ADV_PAY0%`,
       1 AS `Advance_payment`,
       0 AS `Checked*`
FROM `gv_invoicees` gi
INNER JOIN gv_invoicepositions gip ON gi.`InvoiceID` = gip.`InvoiceID`
AND gip.`SKN` = 'AP'
LEFT JOIN gv_persons gp ON gi.`PersonsID` = gp.`AdressID`
LEFT JOIN gv_bookings gbob ON gi.`BookingID` = gbob.`BookingID`
LEFT JOIN gv_objects gob ON gbob.`ObjektID` = gob.`ObjektID`
WHERE `InvoiceType`= 3
  AND `Done`= 1
  AND `Canceled`= 0
  AND (DATE(`DoneAt`) >= '2015-01-01')
GROUP BY gip.`InvoicePositionID`
ORDER BY gi.`InvoiceID`;

答案 2 :(得分:0)

这些可能不起作用的原因有几个。

首先,将代码包装在“就绪”函数中。

// this is a jquery ready function
$(function() {
    $("#sidebar div.find-tabs ul li .block.marginB5").append(":international Patients:<br />904.399.6518 (ext 164)</p>");
});

其次,将脚本放在生成其他动态内容的脚本之后。

第三,如果异步加载动态内容,则需要设置一个超时,以检查动态元素是否存在,然后它可以附加您的内容并停止查找。

$(function() {
    function findElement() {
        var el = $("#sidebar div.find-tabs ul li .block.marginB5");

        // if the element exists, append
        if (el.length > 0) {
            el.append(":international Patients:<br />904.399.6518 (ext 164)</p>");
        }
        // otherwise, try again in 200 milliseconds
        else {
            setTimeout(findElement, 200);
        }
    }
    // start searching for the element
    findElement();
});