【发布时间】:2017-01-08 00:37:47
【问题描述】:
所以我找到了一个脚本,它可以根据下拉菜单中的选择来呈现图像。
但是这个脚本或其他地方将这些 |0 字符附加到图像源的末尾。
这是jquery中的脚本
<script type="text/javascript">
jQuery(document).ready(function($){
var dropdown = '#input_1_10'; // the ID of your dropdown feild
var imageContainer = '#swatches'; // the id of the div which contains your image
$(dropdown).change(function(){
var value = $(this).val();
jQuery(imageContainer).html('<img src="'+value+'" alt="" />');
});
});
</script>
这是我从检查元素窗口看到的
<img src="http://www.whiskey3defensesolutions.com/wp-content/uploads/2016/11/1-Arctic-White.jpg|0" alt="">
这发生在我尝试与下拉选项链接的每张图片上
所以我想做的是切掉|0,但我不知道怎么做
这是在运行 Woocommerce、Woocommerce Gravity forms Add-on 和 Gravity forms plugin 的 wordpress 网站上。
【问题讨论】:
标签: jquery wordpress gravity-forms-plugin