JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Text Boxes & Inputs › SeleclAllOnFocus on NumericTextBox › Reply To: SeleclAllOnFocus on NumericTextBox
Tks for Your help.
I know the post is quite old but only now I’d the time to try to implement it.
I tried with numeric textbox but it doesn’t seem to wotk.
Here my code.<span style=”background-color: #ffffff; padding: 0px 0px 0px 2px;”><span style=”color: #000000; background-color: #ffffff; font-family: ‘Consolas’; font-size: 10pt; white-space: pre;”><span style=”color: #073642; font-weight: bold;”>function</span> </span></span>
function numericTextboxInit() {
console.log(“Entrato”);
for (let i = 0; i < document.getElementsByTagName(‘smart-numeric-text-box’).length; i++) {
console.log(“numero ” + i);
const numericTextbox = document.getElementsByTagName(‘smart-numeric-text-box’)[i];
numericTextbox.addEventListener(‘focus’, (e) => {
setTimeout(() => {
console.log(“Farei”);
e.target.select()
})
});
}
}
You see a loop because I can have more than one numeric textbox.
On the console I see
Entrato
numero 0
numero 1
but nothing happen when I set the focus on a smart-numeric-text-box.
What’s wrong ?
Tks
- This reply was modified 1 year ago by tbettinazzi@axioma.it.