如何删除 php 中 class 中的值(wordpress)?
How to delete value in class in php (wordpress)?
我需要用 if 条件删除 class 里面的 'wsqmylogin'。
我尝试了所有以下代码,但它没有删除 'wsqmylogin'.
请告诉我如何删除它好吗?
现有代码:
<div class="elementor-column">
<div class="elementor-column elementor-element-84c7af1 wsqmylogin" data-id="84c7af1"
data-element_type="column" id="my-checkout">
</div>
</div>
我试过的代码:
<?php
$removeMyLoginJs = <<<EOD
<script>
function myFunction() {
var element = document.querySelectorAll(".elementor-column");
element.classList.remove("wsqmylogin");
}
</script>
EOD;
$currentSlug = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
if(strpos($currentSlug,'order-pay') !== false){
echo $removeMyLoginJs;
}
<?php
$removeMyLoginJs = <<<EOD
<script>
function myFunction() {
var myTbl = document.getElementsByClassName("elementor-row")[0];
var tSomeStyleClasses = myTbl.getElementsByClassName("wsqmylogin");
while (tSomeStyleClasses.length) {
tSomeStyleClasses[0].classList.remove("wsqmylogin");
}
</script>
EOD;
$currentSlug = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
if(strpos($currentSlug,'order-pay') !== false){
echo $removeMyLoginJs;
}
<?php
$removeMyLoginJs = <<<EOD
<script>
(function myFunction() {
var element = document.getElementById("my-checkout");
element.classList.remove("wsqmylogin");
})();
</script>
EOD;
$currentSlug = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
if(strpos($currentSlug,'order-pay') !== false){
echo $removeMyLoginJs;
}
如果您有权访问源代码,您可以尝试从 html/js 文件中删除它 ;)
OOOOr 如果你真的想在运行时删除它,尝试使用 element.parentNode.remove
我需要用 if 条件删除 class 里面的 'wsqmylogin'。
我尝试了所有以下代码,但它没有删除 'wsqmylogin'.
请告诉我如何删除它好吗?
现有代码:
<div class="elementor-column">
<div class="elementor-column elementor-element-84c7af1 wsqmylogin" data-id="84c7af1"
data-element_type="column" id="my-checkout">
</div>
</div>
我试过的代码:
<?php
$removeMyLoginJs = <<<EOD
<script>
function myFunction() {
var element = document.querySelectorAll(".elementor-column");
element.classList.remove("wsqmylogin");
}
</script>
EOD;
$currentSlug = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
if(strpos($currentSlug,'order-pay') !== false){
echo $removeMyLoginJs;
}
<?php
$removeMyLoginJs = <<<EOD
<script>
function myFunction() {
var myTbl = document.getElementsByClassName("elementor-row")[0];
var tSomeStyleClasses = myTbl.getElementsByClassName("wsqmylogin");
while (tSomeStyleClasses.length) {
tSomeStyleClasses[0].classList.remove("wsqmylogin");
}
</script>
EOD;
$currentSlug = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
if(strpos($currentSlug,'order-pay') !== false){
echo $removeMyLoginJs;
}
<?php
$removeMyLoginJs = <<<EOD
<script>
(function myFunction() {
var element = document.getElementById("my-checkout");
element.classList.remove("wsqmylogin");
})();
</script>
EOD;
$currentSlug = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
if(strpos($currentSlug,'order-pay') !== false){
echo $removeMyLoginJs;
}
如果您有权访问源代码,您可以尝试从 html/js 文件中删除它 ;)
OOOOr 如果你真的想在运行时删除它,尝试使用 element.parentNode.remove