首页
\
问答
\
jQuery是(':visible')是(':hidden')没有按预期工作(jQuery is(':visible') is(':hidden') not working as expected)
jQuery是(':visible')是(':hidden')没有按预期工作(jQuery is(':visible') is(':hidden') not working as expected)
在下面的这个脚本中,我将元素设置为可见或隐藏,您可以看到。 但是,一旦显示.closeAdd,如果脚本到达if语句的第二部分,它将不会隐藏。 我注意到jQuery设置它
display:block
当它使用show()时display:block
。 知道如何设置这个吗?if(type === 'user' && action === 'add') { if($('.closeAdd').is(':hidden')) { $('.closeAdd').show(); } } else { //If it's visible and it comes to this part, it will not hide... if($('.closeAdd').is(':visible')) { $('.closeAdd').hide(); } }
In this script below, I set an element to visible or hidden as you'll can see. However, once .closeAdd is shown it will not hide if the script comes to the second part in the if statement. I've noticed that jQuery sets it to
display:block
when it uses show(). Any idea how I can set this right?if(type === 'user' && action === 'add') { if($('.closeAdd').is(':hidden')) { $('.closeAdd').show(); } } else { //If it's visible and it comes to this part, it will not hide... if($('.closeAdd').is(':visible')) { $('.closeAdd').hide(); } }
原文:https://stackoverflow.com/questions/21160292
更新时间:2022-07-16 07:07
最满意答案
尝试这个:
<action name="revert" class="pac.ProcessAction" method="revertData"> <result name="success" type="json"> <param name="root">jsonString</param> </result> </action>
这里“jsonString”应该是一个类级别的变量。
Try this:
<action name="revert" class="pac.ProcessAction" method="revertData"> <result name="success" type="json"> <param name="root">jsonString</param> </result> </action>
Here "jsonString" should be a class level variable.
相关问答
更多-
尝试这个:
jsonString -
我会说,这个调用失败的原因是因为在IIS下使用Windows身份验证时Safari中存在一个错误。 转到您网站的身份验证设置。 右键单击Windows身份验证,选择提供程序并删除协商,从而使NTLM正常工作。 我没有测试过Kerberos。 此问题仅出现在Safari的某些版本中。 I would say that the reason the call is failing is because of a bug in Safari when working with Windows Authentica ...
-
发送ajax调用时出错[内部服务器错误500](Getting error while sending ajax call [internal server error 500])[2023-12-06]
您必须在web.config中将maxJsonLength属性调整为更高的值才能解决此问题。 -
我为您修复的以下代码将不是可靠的解决方案,但会将您推向正确的方向,因为您的代码目前存在很多错误: API的使用不正确 不推荐使用的功能 调用函数的方法不正确 注释掉所有的Ajax代码,让我们尝试使用PHP获得一些结果: class MycomponentControllerAjaxraw extends JController { public function updateReserve() { $input = JFactory::getApplication()->in ...
-
500(内部服务器错误),同时使用ajax codeignitor(500 (Internal Server Error) while using ajax codeigniter)[2022-03-27]
用这个改变你的代码 $query = "SELECT * from info_user Where user_status ='1'"; if(!empty($size)){ $query .= " and city in('".$size."')"; } if(!empty($sprice) && !empty($eprice)){ $query .= " and charge_per_hour >='".$sprice."' an ... -
发生这种情况是因为您没有在模型中进行验证,因此当它尝试创建记录时,它会失败,但会出现异常。 为避免这种情况,您可以在模型中添加验证,这将检查列是否唯一; 如果验证成功,则将创建记录,否则它将返回false并创建错误消息(而不是引发异常)。 您可以在模型验证中添加uniqueness: true ,如下所示: class DistribuicaoPorCargo < ApplicationRecord # scopes, callbacks, ... validates :local_da_prov ...
-
Ajax发布请求导致500内部服务器错误 - Laravel(Ajax post request causes 500 internal server error - Laravel)[2023-10-15]
这是TokenMismatchException in VerifyCsrfToken.php line 67问题 因此,您必须使用Ajax请求发送csrf令牌。 用Dev工具找到它 - >网络 - >然后点击错误 - >它会显示实际响应。 或者,如果您正在使用Postman - 您将在响应中看到该错误。 It was issue with TokenMismatchException in VerifyCsrfToken.php line 67 So you have to send csrf token ... -
用这个 print json_encode(array('type'=>'3', 'data'=>$galleryGrid)); 代替 print json_encode(['type'=>'3', 'data'=>$galleryGrid]); Use this print json_encode(array('type'=>'3', 'data'=>$galleryGrid)); instead of print json_encode(['type'=>'3', 'data'=>$galle ...
-
检查确保您的.htaccess或更改您的网址,如下所示 url: baseurl + "index.php/admin/announcement/remove_attachment", I solved my issue by editing the controller function and not by calling the model. Now my controller is as follows function remove_attachment() { $id=$this->inpu ...