gpt4 book ai didi

javascript - 清除表单输入并保留占位符

转载 作者:行者123 更新时间:2023-11-28 13:43:08 25 4
gpt4 key购买 nike

我知道使用这个jQuery工具

$('.myDiv input').each(function () {
$(this).val("");
});

清除了我的表单,但有人可以帮我提供一些如何保留输入的占位符的建议吗?

现在,只有在我关注至少一个输入后,占位符才会出现。

最佳答案

jQuery

function Clear()
{
$('.myDiv input').each(function () {
$(this).val("");
x=1;
});
$('.myDiv input').first().focus();
}

工作演示 http://jsfiddle.net/s8vPG/2/

关于javascript - 清除表单输入并保留占位符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16442349/

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