gpt4 book ai didi

javascript - 由模态按钮操作设置的元素值在 jquery 中不起作用?

转载 作者:行者123 更新时间:2023-11-28 04:22:55 24 4
gpt4 key购买 nike

我的 jquery 代码是:(这将在模式按钮单击时触发)

$(document).on('click', '.js-modal-remove-button', function () {
$('#code-output').attr('da-url',"1111");
});

我的 html 代码是:

<input type="hidden" name="problemCode" id="code-output" da-url=2/>

问题是我的页面中有一个按钮,在这个按钮上单击模式会打开,并且在模式中还有一个包含类的按钮js-modal-remove-button为此,我需要设置我的主页(其中存在模式打开按钮)da-url 值

最佳答案

只需为您的按钮添加另一个类并使用此 jquery
HTML

<button class="js-modal-remove-button model_button_class"></button>

Jquery

$(document).on('click', '.js-modal-remove-button .model_button_class', function () {
$('#code-output').attr('da-url',"1111");
});

这里.model_button_class是另一个类。
我想这会对你有所帮助。

关于javascript - 由模态按钮操作设置的元素值在 jquery 中不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45305992/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com