English 中文(简体)
网址:www.chry
原标题:Show/Hide div in a php include using Jquery

i 有一个称为div_1.php的网页,内有一页。

 <div id="div_1"></div>

i 网页称为索引。 php with:

 <div id="div_menu"></div>

<?php include("div_1.php"); ?>

“div_menu”是真实的。 “div_1”的明显可见度被定为作风。

#div_1{
    display: none;
}

j 质量功能显示/“div_1”:

$( .form_name ).click(function() {
    // Hide the menu
    $( #div_menu ).hide();

    if(this.id == "form_choice1"){
        // Show the div
        $( #div_1 ).show();
    }
});

The first part (hiding "div_menu") works fine but second part doesn t work!!! if I copy and paste the content of div_1.php into index.php, It works fine !

Why jQuery cannot access to that div? What is wrong when div is inside a php file? I thought that php include only make a copy of content of called page inside the calling page.

问题回答

你似乎不适当地关闭你们的标签。 这很可能混淆了浏览器。 格式如下:</div> not<!div>。 除此之外,您是否对两者产生的超文本进行了比较? 他们同样看待他们。 检查你的浏览器,找出分歧。

我发现,PHP在我的网络服务器(喷气机8)上工作。

我将尝试包括js文档和使用文件。 书写功能,但很奇怪!





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签