简体   繁体   English

删除禁用的输入字段

[英]Remove disabled Input field

I've bought a Wordpress theme, but it collides with one of my essential plugins. 我已经购买了Wordpress主题,但是它与我的必备插件之一冲突。

This is the page: https://inspirebyloui.dk/checkout/ (you need to add a product to the basked to see the issue. Then see the button below "GLS Pakkeshop" and "DAO Pakkeshop".) 这是此页: https : //inspirebyloui.dk/checkout/ (您需要将产品添加到帐本中才能看到问题。然后请参阅“ GLS Pakkeshop”和“ DAO Pakkeshop”下面的按钮。)

I've figured out that I need to remove the disabled parameter in the input field. 我发现我需要在输入字段中删除禁用的参数。

<input disabled type="button" onclick="getShopList('gls', jQuery('#Pakkelabels_zipcode_field').val());" id="pakkelabels_find_shop_btn" name="pakkelabel_find_shop" class="button alt" value="Find nærmeste udleveringssted">

I've managed to remove it with JS, with the following code 我已经设法用JS将其删除,使用以下代码

document.getElementById("pakkelabels_find_shop_btn").disabled = false;

However, it seems like this input field is loaded via Ajax, which is why the above JS code works fine in the console, but when I activate the input field again, it's disabled again. 但是,似乎此输入字段是通过Ajax加载的,这就是为什么上面的JS代码在控制台中可以正常工作的原因,但是当我再次激活输入字段时,它将再次被禁用。

Anyone knows how to deal with this? 有人知道如何处理吗?

BR Martin 马丁

Hej Martin, Hej Martin,

You could use jQuery and do something like this: 您可以使用jQuery并执行以下操作:

jQuery("#Pakkelabels_zipcode_field").on("input",function(){
document.getElementById("pakkelabels_find_shop_btn").disabled = false;
});

This would activate the button after the user has input a postal code. 用户输入邮政编码后,这将激活按钮。

Hope that helps. 希望能有所帮助。

God dag! 天哪!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM