Javascript Jquery加载后使用函数

Javascript Jquery加载后使用函数,javascript,jquery,css,Javascript,Jquery,Css,在使用partials-.load()函数之后,我无法使用jquery函数。 我尝试过.val()和背景图像更改之类的函数,但什么都没有发生。 我猜它与.load()有关,因为我找不到任何其他原因。。。 也许我必须使用live func或其他什么。。。 这是我在主页上的主要div,当我在我的网站上导航时,我会将其加载到其中: <div id="mainContent"> </div> CSS代码: /* Rent Car Page Css*/ .carDivs {

在使用partials-.load()函数之后,我无法使用jquery函数。 我尝试过.val()和背景图像更改之类的函数,但什么都没有发生。 我猜它与.load()有关,因为我找不到任何其他原因。。。 也许我必须使用live func或其他什么。。。 这是我在主页上的主要div,当我在我的网站上导航时,我会将其加载到其中:

<div id="mainContent">
</div>
CSS代码:

/* Rent Car Page Css*/
.carDivs
{
    border: 1px solid black;
    float:right;
    width:200px;
    height:200px;
    border-radius: 65px;
    box-shadow: 0px 0px 15px 15px #FFFFFF;
}
#d1 ,#d2
{
    margin-left: 100px;
    margin-right: 155px;
    margin-top: -120px;
}

#d3, #d4
{
    margin-top: 112px;
    margin-left: 100px;
    margin-right: 155px;
}

#mazHead
{
    margin-left: 235px;
}
#toyHead
{
    margin-left: 683px;
    margin-top: -26px;
}
#porHead
{
    margin-top: 269px;
    margin-right: 87px;
    margin-left: 217px;
}
#infHead
{
    margin-top: 268px;
    margin-left: 260px;
}

.carHeads
{
    display:inline-block;
    font-family: Copperplate, "Copperplate Gothic Light", fantasy;
    font-size: 26px;
    vertical-align:top
}

“页面”加载到DOM后,必须调用
rentPics()

诸如此类:

$.load("url_to_your_page_containing_carNavigation", function () {
   renderPics();
});
第二个参数(函数…)将仅在页面完成加载时调用,因此,
#d1
将在DOM树中可用


有关详细信息,请参见官方
$.load

请发布完整的代码,包括css。在body标签上使用“onload”属性…刚刚工作,我是新手,不能给你一个肯定的,但希望其他人会:)
/* Rent Car Page Css*/
.carDivs
{
    border: 1px solid black;
    float:right;
    width:200px;
    height:200px;
    border-radius: 65px;
    box-shadow: 0px 0px 15px 15px #FFFFFF;
}
#d1 ,#d2
{
    margin-left: 100px;
    margin-right: 155px;
    margin-top: -120px;
}

#d3, #d4
{
    margin-top: 112px;
    margin-left: 100px;
    margin-right: 155px;
}

#mazHead
{
    margin-left: 235px;
}
#toyHead
{
    margin-left: 683px;
    margin-top: -26px;
}
#porHead
{
    margin-top: 269px;
    margin-right: 87px;
    margin-left: 217px;
}
#infHead
{
    margin-top: 268px;
    margin-left: 260px;
}

.carHeads
{
    display:inline-block;
    font-family: Copperplate, "Copperplate Gothic Light", fantasy;
    font-size: 26px;
    vertical-align:top
}
$.load("url_to_your_page_containing_carNavigation", function () {
   renderPics();
});