Blur: function(sender, args, timeout);
sender. Event source.
args. Event information.
timeout. Time delay (milliseconds) after which the event is fired.
The Blur event occurs when the text field loses focus.
To execute the example, the page must contain the TextBox component named textBox (see Example of Creating the TextBox Component). Create the second text box with the hidden text, handle the following events: Blur, Focus, ValueChanged, set focus for the text box:
// Set transparent text of the first text box textBox.setWatermarkText("Text box 1"); // Create the second text box var textBox2 = new PP.Ui.TextBox({ ParentNode: "TL", // Parent container identifier EnableEdit: true, // Enable editing MaxLength: 24, // Maximum text length in component IsPassword: true // Indicates whether text is hidden }); // Set text for the second text box textBox2.setContent("Text box 2"); // Set focus removal event handler textBox.Blur.add(function (sender, args, timeout) { console.log("The Blur event is initiated") }); // Set get focus event handler textBox2.Focus.add(function (sender, args, timeout) { console.log("The Focus event is initiated") }); // set focus to the first text box textBox.setFocus();
// Deselect focus from the first text box
textBox.blur(); // Set focus in the second text box textBox2.setFocus();
After executing the example the second text box with a hidden text is created:
The browser console displays information that the handled events have been fired:
The Blur event is initialized
Focus event initialized