Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在if-else jquery中添加新函数_Javascript_Jquery - Fatal编程技术网

Javascript 在if-else jquery中添加新函数

Javascript 在if-else jquery中添加新函数,javascript,jquery,Javascript,Jquery,My jquery代码的工作方式是如果它没有找到My值,它将显示:无。我想补充一点,除了隐藏之外,另一个div类是另一个css。如何将此添加到此条件中 我想,另外$(“.footer”).css(“位置”,“固定”) 不要直接返回测试结果,而是在执行所需操作的if()中使用它,然后返回结果 $rows.show().filter(function() { text = $(this).text().replace(/\s+/g, ' '); if (!reg.test(text)

My jquery代码的工作方式是如果它没有找到My值,它将
显示:无。我想补充一点,除了隐藏之外,另一个div类是另一个css。如何将此添加到此条件中

我想,另外
$(“.footer”).css(“位置”,“固定”)


不要直接返回测试结果,而是在执行所需操作的
if()
中使用它,然后返回结果

$rows.show().filter(function() {
    text = $(this).text().replace(/\s+/g, ' ');
    if (!reg.test(text)) {
        $otherDiv.css("color", "red");
        return true;
    }
}).hide();

我还建议使用
.hide()
.show()
而不是
.css()

可以创建小提琴吗?您的问题有点让人困惑,什么值,为什么条件,以及在哪个div上?
$rows.show().filter(function() {
    text = $(this).text().replace(/\s+/g, ' ');
    if (!reg.test(text)) {
        $otherDiv.css("color", "red");
        return true;
    }
}).hide();