I'm learning how to build widgets, and am attempting to build a widget that uses the jQuery plugin found here (I'm a Javascript/jQuery beginner). The goal is to give an input box better masking functionality.
The plugin adds a .mask()
function to the jQuery
object, and I need help accessing that function in my widget. I started with the OnChange Input Box, added the plugin source to the required modules, and attempted to access the .mask()
function, but was unsuccessful.
Detailed steps are below. Can anyone give guidance on how to use a jQuery plugin in a widget?
Detailed steps
- Add the plugin source file to \WidgetHomeDirectory\src\lib (
maskedInput.js
) - In the widget, add the path and corresponding parameter name to
define
(I added them after the entries for the jQuery library) - Modified line 8 of
maskedInput.js
to readreturn jQuery
to resolve a compile error
The red box in this image shows where I attempt to use .mask()
. My browser reports "Could not create widget mxui.widget.PrimitiveWidgetWrapper: TypeError: $(...).mask is not a function". The syntax was copied directly from the developer's web sitescreenshot: