Open 374632897 opened 7 years ago
html
const html = `<input type="text" class="form-control" style="width:248px;" value="点菜测试" data-reactid=".sceo9k633s.2.1.1.0.3.1.0.0">`; html.match(/([\w]+)\s*?=\s*?(["'])([\s\S]*?)\2/g).map(item => item.slice().split('=').join(' => ')) // ["type => "text"", "class => "form-control"", "style => "width:248px;"", "value => "点菜测试"", "reactid => ".sceo9k633s.2.1.1.0.3.1.0.0""]
获取一个
html
元素的属性