Changing meta-tags dynamic with jQuery

后端 未结 4 1093
慢半拍i
慢半拍i 2020-12-04 11:19

These are my meta-tags:




        
相关标签:
4条回答
  • 2020-12-04 11:47
    $("meta[name='og:title']").attr('content', 'my new title');
    

    Using "property=" does not work in Chrome

    0 讨论(0)
  • 2020-12-04 12:08

    You could give each meta element an ID or Class.

    $('#metaelement').attr('content', 'my new meta description');
    
    0 讨论(0)
  • 2020-12-04 12:12

    Make sure your quotes are like this:

    $('meta[property="og:description"]').attr('content',"$modified_desc" );
    
    0 讨论(0)
  • 2020-12-04 12:14

    I think you should escape : look at the documentation

    $("meta[property='og\\:title']").attr("content", result.title);
    
    0 讨论(0)
提交回复
热议问题