div load html 传参,jQuery load html specific div into webpage

这篇博客探讨了如何通过jQuery实现点击链接时,将外部HTML页面的内容加载到特定的div中,并实现内容的滑动显示。作者面临的问题是无法在jQuery的load方法中正确使用变量来指定要加载的div标签。博客还提到了需要解决的内容隐藏和重新显示的问题,以便在选择不同链接时能正确切换显示相应的内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

having a bit of a issue

got four links when clicked i want to to load in content from an external html page into a div called content which slides down and shows the content from the external html page, but I want to use the href from the links to load in specific div tags from the external html page.. I'm nearly there just missing the final part.. I cant seem to use my variable inside my jquery load statement..

this is what ive got so far..

$("#services a").click(function(){

var href = $(this).attr("href");

console.log(href)

$('#content').slideToggle(function(){

$("#content").load("services.html" + href);

});

return false;

});

also if anyone could point me how to slide the content div back when selecting a different link and then show that content for that link.. would be great..

thanks guys..

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值