【发布时间】:2021-05-26 17:08:54
【问题描述】:
首先这是我在 Stackoverflow 中的第一个问题,因为我现在遇到了一个问题。所以希望有人可以帮助我。
项目:我正在为网站构建产品配置器。主要目标是,客户可以配置他们的产品,并且他们选择的选项会自动放置在联系表中。
网站:https://soundgreets.com/produkt/konfigurator/
我正在使用 Elementor 开发 Wordpress。我用于配置器的插件是:“Woocommerce Extra Product options”
我的问题:我需要获取特定选定容器的 ID,并在下面的表格中自动填写。
网站:https://soundgreets.com/produkt/konfigurator/
有人知道我该怎么做吗?也许在 .php 文件中?还是在元素中?我在网站上做了一些大规模的 CSS,所以它看起来就像现在一样。
这个 Selector 是用来选择 Dropdowns 的所有容器。
.tc-extra-product-options .cpf-type-select .tmcp-field-wrap label.fullwidth select{
color: red;
}
我也尝试过是使用 Elementors Html Code-widget 来获取容器的特定 Id 的变量。
这不起作用:输出是“未定义”
<html>
<head>
<script>
var e = document.getElementById("tmcp_select_160362915b5ef2");
var strUser = e.options[e.selectedIndex].text;
</script>
</head>
<body>
<script>
document.write(strUser)
</script>
</body>
</html>
我希望有人对此有所了解。
提前致谢
贝尔坎
PS:网站可能看起来有点乱,对此我很抱歉
【问题讨论】:
标签: php html css wordpress elementor