首页 \ 问答 \ jQuery:将display css从display:none改为显示:block not working(jQuery: changing div css from display:none to display:block not working)

jQuery:将display css从display:none改为显示:block not working(jQuery: changing div css from display:none to display:block not working)

我正在根据复选框值更改div的内容。 除了一个复选框选项之外,div的值是简单文本。 在例外情况下,div的值是另一个div(可以说childDiv)。

所以,当点击其他两个选项时,我改变childDiv的可见性( display: none通过jQuery.css() ),并在单击异常选项时将其更改为display: block

当我更改复选框选项时,childDiv变为隐藏。 但是,当我希望它可见时它不会再显示。

小提琴在这里: http//jsfiddle.net/sandeepy02/jLgyp/

代码是

            <div class="switch switch-three candy blue" id="reachout">
                <input name="reachout" type="radio" id="tab-41" value="1" checked="checked"/>
                    <label for="tab-41">Experience</label>
                <input name="reachout" type="radio" id="tab-42" value="2"/>
                    <label for="tab-42">Contact Us</label>
                <input name="reachout" type="radio" id="tab-43" value="3"/>
                    <label for="tab-43">Why?</label>
                <div id="test1234">
                    <div id="test12345">
                        Option Start
                    </div>
                </div>
                <span class="slide-button"></span>
            </div>  

     jQuery("input[name='reachout']",jQuery('#reachout')).change(
        function(e)
        {                   
            if(jQuery(this).val()=="1") 
            {
                jQuery("#test1234").html("");
                jQuery("#test12345").css("display","block");
            }
            if(jQuery(this).val()=="2") 
            {
                jQuery("#test1234").html("Option 2");
                jQuery("#test12345").css("display","none");
            }
            if(jQuery(this).val()=="3") 
            {
                jQuery("#test1234").html("Option 3");
                jQuery("#test12345").css("display","none");
            }
        });

我甚至尝试过

            jQuery("#test12345").css('position', 'absolute');
            jQuery("#test12345").css('z-index', 3000);

display: blockdisplay: block但没有奏效。

谢谢


I am changing the content of a div based on the checkbox value. the value of the div is simple text for all but one checkbox option. In the exception case, the value of div is another div (lets say childDiv).

So I am changing the the visibility of the childDiv (display: none through jQuery.css()) when the other two options are clicked, and changing it to display: block when the exception option is clicked.

The childDiv becomes hidden when I change checkbox option. However it does not display back again when I want it to be visible.

The fiddle is here: http://jsfiddle.net/sandeepy02/jLgyp/

The code is

            <div class="switch switch-three candy blue" id="reachout">
                <input name="reachout" type="radio" id="tab-41" value="1" checked="checked"/>
                    <label for="tab-41">Experience</label>
                <input name="reachout" type="radio" id="tab-42" value="2"/>
                    <label for="tab-42">Contact Us</label>
                <input name="reachout" type="radio" id="tab-43" value="3"/>
                    <label for="tab-43">Why?</label>
                <div id="test1234">
                    <div id="test12345">
                        Option Start
                    </div>
                </div>
                <span class="slide-button"></span>
            </div>  

and

     jQuery("input[name='reachout']",jQuery('#reachout')).change(
        function(e)
        {                   
            if(jQuery(this).val()=="1") 
            {
                jQuery("#test1234").html("");
                jQuery("#test12345").css("display","block");
            }
            if(jQuery(this).val()=="2") 
            {
                jQuery("#test1234").html("Option 2");
                jQuery("#test12345").css("display","none");
            }
            if(jQuery(this).val()=="3") 
            {
                jQuery("#test1234").html("Option 3");
                jQuery("#test12345").css("display","none");
            }
        });

I even tried

            jQuery("#test12345").css('position', 'absolute');
            jQuery("#test12345").css('z-index', 3000);

after display: block but that didnt work.

Thanks


原文:https://stackoverflow.com/questions/15779804
更新时间:2021-12-13 15:12

最满意答案

新创建的文件和目录的默认权限由umask环境变量设置。 该文件的所有者和根可以更改权限。

如果您不需要在应用程序中使用chmod,请将其保留在禁用列表中。 他们应该看看安全性的方式是:许多比我更聪明的人现在已经使得chmod成为我应用程序中更安全的部分之一。 因此,我会花费我的时间让其他部分安全。

在服务器上将应用程序设置为只读,如果将其自动化,则可以。 当你修改你的应用程序代码时,它会让你感到非常困难。 在某些情况下,您会来回更改代码并在服务器上测试它们,然后忘记将文件/目录权限重置为只读。

如果您的生产机器上只有一个用户帐户,我只需坚持默认权限即可为您管理事宜。 或者,您可以删除组和“其他”权限,如下所述。

一个典型的生产设置应该是拥有一个属于你的应用程序组。 您还需要一个单独的用户来运行您的PHP应用程序。 保持所有者和组的完全权限,并从“其他”中移除所有权限。 这条路:

  • 开发人员保留他们的个人登录信息 - 您可以跟踪谁在什么时间进行了操作
  • 您和其他开发人员可以将新代码复制到服务器。
  • 应用程序可以运行代码。
  • 应用程序无法访问代码之外的任何内容。
  • 没有其他用户可以看到您的代码。

我猜这是管理你的生产服务器的其他人的工作? 他们会花时间确保没有人可以登录和徘徊。 虽然你确实需要确保没有人能够运行操作系统命令,但我认为最好的开始就是学习xss 。 默认的PHP服务器设置应该没问题。 应用程序中安全性最低的部分是只有你见过的部分。 如果有人要访问系统调用,最有可能通过表单。 即使你消除了系统调用,表单仍然容易存储JavaScript。 除非您在应用程序中存储信用卡,否则更可能的目标是用户浏览器中的密码/会话。


The default permissions for newly created files and directories are set by the umask environment variable. The file's owner and root can change the permissions.

If you don't need to use chmod in your app, then leave it in your disable list. They way you should look at security is: Many people smarter than me have now make chmod one of the more secure parts of my application. Therefore, I will spend my available time making the other parts secure.

Making your application read-only, on the server, is ok to do if you automate it. When you make changes to your application code, it's going to make things very difficult for you though. At some point, you will go back and forth, making some code changes and testing them on the server... and then forgot to reset your file/directory permissions back to read only.

If you only have 1 user account on your production machine, I would just stick with the default permissions- things are probably managed for you. Or you can remove group and "other" permissions, as described below.

A typical production setup, would be to have an application group that you belong to. You also want a separate user for running your php application. Keep full permissions for the owner and group, and remove all permissions from "other". This way:

  • Developers keep their individual logins - you can track who did what when.
  • You and other developers can copy new code to the server.
  • The application can run the code.
  • The application can not access anything outside the code.
  • No other users else can see your code.

I'm guessing it's someone else's job to manage your production server? They will spend time to make sure no one can login and poke around. While you do need to make sure no one can run operating system commands, I think the best place to start is to learn about xss. The default php server settings should be ok. The least secure part of the application, is the part only you have seen. If someone is going to access a system call, it most likely to be through a form. Even if you eliminate system calls, the forms are still susceptible to storing javascript. Unless you are storing credit cards in your application, the more likely target would be the password/session in your user's browser.

相关问答

更多
  • 通常,该文件应归Web服务器用户所有,或者属于Web服务器用户的组。 假设您的Web服务器在www-data下运行,那就意味着运行: chmod u+w file.txt # write access for the file's user chmod ugo+r file.txt # read access for user, group, other chown www-data file.txt # change owner 或这个: chmod g+w file.txt ...
  • 除了执行访问之外,还需要读取访问权限才能列出目录。 如果您只有执行访问权限,那么您可以找出目录中条目的名称,但没有其他信息(甚至不是类型,因此您不知道哪些条目是子目录)。 这对我有用: find . -type d -exec chmod +rx {} \; You need read access, in addition to execute access, to list a directory. If you only have execute access, then you can find ...
  • 新创建的文件和目录的默认权限由umask环境变量设置。 该文件的所有者和根可以更改权限。 如果您不需要在应用程序中使用chmod,请将其保留在禁用列表中。 他们应该看看安全性的方式是:许多比我更聪明的人现在已经使得chmod成为我应用程序中更安全的部分之一。 因此,我会花费我的时间让其他部分安全。 在服务器上将应用程序设置为只读,如果将其自动化,则可以。 当你修改你的应用程序代码时,它会让你感到非常困难。 在某些情况下,您会来回更改代码并在服务器上测试它们,然后忘记将文件/目录权限重置为只读。 如果您的生产 ...
  • 问题与数据转换有关。 $chmod = "0777"; chmod($filename, octdec($chmod)); 通过传递$ chmod字符串,它转化为777女巫并不会让你想要。 octdec(“0777”)会输出511,那么十进制会给chmod所需的值。 The problem has to do with data conversion. $chmod = "0777"; chmod($filename, octdec($chmod)); By just passing in the $c ...
  • Joomla在其所有'目录中都有空白的index.html文件,如果有人试图访问特定文件夹,他们会看到一个空白屏幕,而不是文件树。 因此,创建一个空白的index.html文件并将其上传到您希望隐藏文件名的文件夹 Joomla has blank index.html files in all its' directories to that if someone tried to access a specific folder, they would see a blank screen, instea ...
  • 我将文件复制到~/.ssh文件夹,然后用chmod更改了权限。 这样做了。 只是为了提供更多信息,ssh文件夹的权限, drwx------ 8 roh21 108 272 Jun 26 17:26 .ssh 以及我最初使用的文件夹的权限 drwxrwxrwx 2 roh21 108 2048 Jun 23 06:32 startup 我很好奇为什么即使多次尝试使用chmod -R选项后我也无法更改startup文件夹的权限。 另外,请注意我在学校的图书馆中使用Mac ...
  • 问题是你没有得到这个文件的新标志,你打印你在调用chmod 之前获取的旧标志。 The problem is that you don't get the new flags for the file, you print the same old flags you fetched before calling chmod.
  • 从du删除$()并对行进行sort使它们如下所示: sudo du -hs /home/test/* >> /home/test/hello.txt sudo sort -n /home/test/hello.txt >> /home/test/hello1.txt $()将括号内的操作结果作为命令执行。 如果此结果不是可以运行的结果,您将收到各种错误消息。 权限被拒绝了,因为$()里面的结果恰好在你的机器上,也恰好是你无法执行的东西。 在我对你的脚本的测试中,我也得到Is a directory com ...
  • ~/.bashrc在用户登录时以用户身份运行。它不会在启动时运行。 如果要更改文件的权限,则需要具有此权限。 该消息告诉您没有权限 - 只有root才能这样做。 在启动时执行自定义操作的最简单方法是将其粘贴到文件/etc/rc.local 。 这个脚本在启动后由root运行(所以每次重启时都是如此),所以你可以将chmod命令放在那里。 ~/.bashrc is run as the user when the user logs in. It is not run on boot. If you want ...
  • s部分是setuid位。 维基百科 : setuid和setgid(“执行时设置用户ID”和“执行时设置组ID”的缩写)是Unix访问权限标志,允许用户分别使用可执行文件所有者或组的权限运行可执行文件并更改行为在目录中。 该权限字符串表示: 所有者可以读取,写入和执行 文件组中的用户可以读取和执行 其他用户可以阅读和执行 该文件已设置setuid 您可以通过运行chmod 06755 /system/bin/su来设置该特定权限。 这是八进制(=“八分之一”,像十进制是“十分之一”,十六进制是“十六分之一” ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)