AddcitedToLearn
AddcitedToLearn

Reputation: 398

jQuery how to load a div from a other page using load

I have a little project where I need to show items on one page from a other so I have a little categorie where you can click on. Then I pick the attr("href"); and set that to the page I would like to load. this works.
But how to add a <div> to it so I online load like the <div class="holder"></div> And not the whole div?
This is my function:

function setupCasesFilter() 
{       
    j(".casemenu a").click(function(e) {
        e.preventDefault();
        j("ul.casesholder").load(j(this).attr("href")); 
    });
}

Where I can add the class inside attr("href")); ?

Upvotes: 0

Views: 77

Answers (1)

Jai
Jai

Reputation: 74738

If you want to load a specific div element from the url then use it this way:

j("ul.casesholder").load(j(this).attr("href") + " .holder"); 

What seems to me that you have a .holder div on the href page you are loading, so you can pass that div's class name which you want to load with a space for ex. page.html .holder.

Upvotes: 2

Related Questions