[英]How to remove attribute on input type to click? Angular?
I need to remove on click input type attribute.我需要删除点击输入类型属性。 Example:
例子:
<input type="number" (click)="removeInputModeAtribute()" inputmode="none">
removeInputModeAtribute(){
//remove inputmode="none"
}
as @AlphaMirage said you can use removeAttribute
function正如@AlphaMirage所说,您可以使用
removeAttribute
function
if you want to remove inputmode
just pass the element into your function and use removeAttribute
like:如果您想删除
inputmode
,只需将元素传递到您的 function 并使用removeAttribute
如下:
in your .ts
file在您的
.ts
文件中
removeEl(el:HTMLInputElement) {
el.removeAttribute('inputmode');
}
and in your .html
在你的
.html
<input type="number" #el (click)="removeEl(el)" inputmode="none">
I don't know angular but you can do this with plain javascript:我不知道 angular 但你可以用普通的 javascript 做到这一点:
function remove(what) { alert('You Will Only See This On The First Click.') what;removeAttribute("onclick"); }
<button onclick='remove(this)'>BUTTON</button>
Turns out this is not the answer!原来这不是答案!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.