How do I set up parsely with nodejs

0 votes

For days, I've been working on form validation. I'm trying to validate a form that has multiple steps.

Nodejs, ES6, Express, and PUG are the technologies I'm using. I'm having trouble coming up with something that works. I believe parsley would do the trick for me, but I'm having trouble getting it to work with NodeJS.

In my.js file, I have the following code (where risk-calc is the id of my form):

$('.form-navigation .next').click(function() {
  if ($('#risk-calc').parsley().validate({group: 'block-' + curIndex()}))
    navigateTo(curIndex() + 1);

My console error is '$(...).parsley is not a function.'

I've installed via NPM parselyjs and jquery.

edit.

Attempting to use webpack to add global variables.

Something is still wrong, but how does this look?

plugins: [
    new ExtractTextPlugin('style.css'),
    new webpack.ProvidePlugin({
      $: 'jquery',
      jQuery: 'jquery',
      parsley: 'parsleyjs/dist/parsley.js'
    }),
Jun 21 in Node-js by Vaani
• 7,020 points
6 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Node-js

0 votes
1 answer

How do I get the path to the current script with Node.js?

Hello @kartik, you can do this: fs.readFile(path.resolve(__dirname, 'settings.json'), 'UTF-8', ...READ MORE

answered Jul 8, 2020 in Node-js by Niroj
• 82,720 points
1,705 views
0 votes
1 answer

How do I “include” functions from my other files in nodejs?

Hello @kartik, You require any js file,so you just ...READ MORE

answered Jul 9, 2020 in Node-js by Niroj
• 82,720 points
1,488 views
0 votes
1 answer

How do I determine the current operating system with Node.js

Hello @kartik, With Node.js v6 (and above) there ...READ MORE

answered Jul 14, 2020 in Node-js by Niroj
• 82,720 points
2,137 views
0 votes
1 answer

How do I determine the current operating system with Node.js?

Hello @kartik, With Node.js v6 (and above) there ...READ MORE

answered Jul 20, 2020 in Node-js by Niroj
• 82,720 points
195 views
0 votes
1 answer

How do I create a HTTP Client Request with a cookie?

Hello @kartik, The use of http.createClient is now deprecated. You ...READ MORE

answered Oct 16, 2020 in Node-js by Niroj
• 82,720 points
2,927 views
+2 votes
1 answer

How do I debug Node.js applications?

Hello @kartik, Use node-inspector  from any browser supporting WebSocket. Breakpoints, ...READ MORE

answered Jul 8, 2020 in Node-js by Niroj
• 82,720 points
347 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
970 views
0 votes
1 answer
0 votes
1 answer

Protocols used in a distributed/dlt system for the nodes to establish communication

yes all are over TCP/IP connections secured by TLS encryption in hashgraph architecture-hashgraph, ...READ MORE

answered Aug 6, 2018 in Blockchain by aryya
• 7,440 points
623 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP