Quantcast
Channel: Mendix Forum Questions
Viewing all articles
Browse latest Browse all 82402

How should jQuery plugins be incorporated into a widget?

$
0
0

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

  1. Add the plugin source file to \WidgetHomeDirectory\src\lib (maskedInput.js)
  2. In the widget, add the path and corresponding parameter name to define (I added them after the entries for the jQuery library)
  3. Modified line 8 of maskedInput.js to read return 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:


Viewing all articles
Browse latest Browse all 82402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>