我想从 url 栏中获取 id 并将其插入到 href 中
$("a[href='send_message.php?act=pm&id=$id']").colorbox({width:"500", height:"350", iframe:true});
最佳答案
有一个 jquery 插件可以使这变得非常简单:
参见:http://plugins.jquery.com/project/query-object
例如
var id = $.query.get('id');
$("a[href='send_message.php?act=pm&id="+id+"']").colorbox({width:"500", height:"350", iframe:true});
关于javascript - 网址栏 id=1 转成 jQuery ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1015870/