Reputation: 2180
Hello Friends check my code http://jsfiddle.net/sUaky/2/ i want to load a web page in a div using the load()
function but code is not working plz help me out
Thank in advance
Upvotes: 0
Views: 98
Reputation: 9782
where is you id??
that you are trying to click like??
$('#tab-1').click();
your click event not happening because there is no id you are getting.
According to your fiddle, first you have to get the href
attributes value, then your match your click event with the value.
UPDATE
try with this example,,
$('#tabs ul li a').each(function(i, e){
$(this).click(function(e){
e.preventDefault();
var id = $(this).attr('href');
if( id == '#tab-1' ){
alert(id);
// Don't use cross domain here
$('#youtube_tab').load('index.html');
}
});
});
Upvotes: 0
Reputation: 3900
Jogesh is right. But to solve, just give your anchors an id, like in this fiddle.
Then choose a local page that you are allowed to load, for the url.
Upvotes: 0
Reputation: 6052
Cross Domain wont work. You can only load pages the same domain where the page is loaded.
Read more here :
http://en.wikipedia.org/wiki/Same_origin_policy
Upvotes: 2