Skip to content

@utilslib/web/removeAttribute


移除属性


removeAttribute

函数签名

typescript
function removeAttribute(element: Element, attributeName: string): void

描述

移除属性

参数

参数名类型可选默认值描述
elementElement--
attributeNamestring--

返回值

void

点击查看源码
js
/**
 * 移除属性
 * @param element - 目标元素
 * @param attributeName - 属性名
 */
export function removeAttribute(element, attributeName) {
  if (element) {
    element.removeAttribute(attributeName);
  }
}
ts
/**
 * 移除属性
 * @param element - 目标元素
 * @param attributeName - 属性名
 */
export function removeAttribute(element: Element, attributeName: string): void {
  if (element) {
    element.removeAttribute(attributeName);
  }
}

如有错误,请提交issue :::