3

我正在使用 Moovweb SDK 并正在优化我的个人桌面网站以进行移动。

如何将所有<p>标签转换为<div>标签?我真的不想手动做!搜索和替换??哈哈

4

2 回答 2

5

您可以使用 name() 函数来更改元素的名称。例如:

$("//p") {
    name("div") 
}

在此处查看实际操作:http: //tester.tritium.io/bd1be4f2c187aed317351688e23f01127d26343a

于 2013-06-18T00:41:02.720 回答
3

Cheap way: Add p{margin:0} to your CSS, this will remove the only special styling of <p> tags making them look like <div>s.

This is only a visual effect, though. For instance, you're still not allowed to put a <form> inside a <p>, even with the above CSS. If that's what you're after, a simple search and replace will do:

  • Replace <p> with <div>
  • Replace <p␣ (left angle, p, space) with <div␣ (there's a space at the end of that one too)
  • Replace </p> with </div>

That should do it!

于 2013-06-18T00:43:24.883 回答