Javascript 如何使用jQuery添加元标记?

Javascript 如何使用jQuery添加元标记?,javascript,jquery,Javascript,Jquery,我想使用jQuery在我的站点标题中添加meta标记。我该怎么做 提前谢谢。试试这个 <script type="text/javascript"> $(document).ready(function() { $("head").append("<meta name=viewport content=width=400, initial-scale=0.45, minimum- scale=0.45/><link rel=apple-touch

我想使用jQuery在我的站点标题中添加meta标记。我该怎么做

提前谢谢。

试试这个

<script type="text/javascript"> 
 $(document).ready(function() {
     $("head").append("<meta name=viewport content=width=400, initial-scale=0.45, minimum-    scale=0.45/><link rel=apple-touch-icon href=/images/customIcon.png/><meta name=apple-mobile-web-app-capable content=no /><meta name=apple-mobile-web-app-status-bar-style content=black-translucent /><link rel=apple-touch-icon-precomposed href=/images/customIcon.png/> ");
});

$(文档).ready(函数(){
$(“标题”)。附加(“”);
});


$(文档).ready(函数(){
$(“meta[name='og:title']”)attr('content','my new title');
});

这里似乎已经涵盖了这一点-请在发布前搜索,或者在这种情况下,只需查看网站专门询问您是否已检查的问题列表。@SuperBiasedMan我现在编辑了我的答案检查。我使用过,但它对我无效。:(
 <script type="text/javascript"> 
 $(document).ready(function() {      

  $("meta[name='og:title']").attr('content', 'my new title');
 });
 </script>