We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
insertAdjacentHTML
insertAdjacentElement
第二个参数的类型不同, 前者接收的是是要被解析为HTML或XML元素的字符串,而后者接收的是一个element元素。
是要被解析为HTML或XML元素的字符串
element
const one = document.getElementById('one'); one.insertAdjacentHTML('afterend', '<div id="two">我是two</div>'); const one = document.getElementById('one'); const two = document.createElement('div') two.innerHTML = '我是two'; one.insertAdjacentElement('afterend', two);
The text was updated successfully, but these errors were encountered:
问一下 insertAdjacentHTML 和innerHtml 这两者有什么区别?看着表现形式一样的
Sorry, something went wrong.
No branches or pull requests
insertAdjacentHTML
和insertAdjacentElement
的区别第二个参数的类型不同, 前者接收的是
是要被解析为HTML或XML元素的字符串
,而后者接收的是一个element
元素。The text was updated successfully, but these errors were encountered: