Sonu Singh
Sonu Singh

Reputation: 354

jQuery-maskMoney not working with Rails 6

I tried a lot to fix this issue but didn't get any success. Here package details https://classic.yarnpkg.com/en/package/jquery-maskmoney I am using

rails 6.0.3.1
ruby 2.6.2

I followed the below steps. $ yarn add jquery-maskmoney after this package added successfully into yarn.lock and package.json

yarn.lock Screenshot from 2020-08-21 13-12-03

package.json

Screenshot from 2020-08-21 13-12-15

Now require jquery-maskmoney in application.js app/javascript/packs/application.js require("jquery-maskmoney")

Getting below error Screenshot from 2020-08-21 13-19-12

Can you please help me to fix this issue? If you need more information please let me know. Thank you so much in advance.

Upvotes: 0

Views: 233

Answers (1)

Sonu Singh
Sonu Singh

Reputation: 354

I have implemented solution and it's working fine.

Please download maskMoney.js from here maskMoney.js

Now follow the steps.

Add the above jquery-maskmoney.js in the app/javascript/packs/modules/common/jquery-maskmoney.js

In app/javascript/packs/application.js import

import './modules/common/jquery-maskmoney.js'

Now you use $('.maskmoney').maskMoney() in all places.

Upvotes: 3

Related Questions