...
Code Block |
---|
|
function myFunc(selection, textBox) {
var boxID = textBox.id;
alert(boxID)
}
myFunc; |
Note: If the textbox has the float placeholder property enabled, the DOM structure of the textbox widget is altered, in that the textbox's <input> element is wrapped in a <div> element, which then adopts the widget's id. In this case, the onselect event handler could be written like in Example 3, below.
Example 3: (Same as Example 2, but supports widgets using floating placeholders)
Code Block |
---|
|
function myFunc(selection, textBox) {
var boxID;
if (textBox.classList.contains("pui-floating-placeholder-input")) boxID = textBox.parentElement.id; // If floating placeholder exists, get the id from the parent div
else boxID = textBox.id;
alert(boxID);
}
myFunc; |