关于前端:jquery动态添加altkeywordsdescriptiontitle

8次阅读

共计 314 个字符,预计需要花费 1 分钟才能阅读完成。

1.jquery 给 img 动静增加 alt 属性

$(document).ready(function(){$("img").each(function(){$(this).attr('alt','11111');
      });
});

2. 动静增加 keywords、description 关键字

$("meta[http-equiv='X-UA-Compatible']").after(`<meta name="keywords" content="${keywords}">
      <meta name="description" content="${description}">`
);

3. 动静增加页面 title

document.title = 'title';
正文完
 0