1

I have a problem when I try to install via nuget manager, when I search for 'autonumeric' I can clearly see that the latest version is 1.9.45

When I go to project site, I can see that version 1.9.45 is obsolete. So, I want to get version 4.* but I do not know how. I also tried vie npm install command and nothing.

My question is: How can I download and incorporate the new version of autoNumeric in my MVC Web Project?

Steps:

  1. Download zip from GitHub link

  2. Unzip the folder and navigate to src folder

  3. Copy all files to your solution for example to: Scripts/autoNumeric folder
  4. Add it in your bundle like:

    bundles.Add(new ScriptBundle("~/bundles/autoumeric").Include( "~/Scripts/autoNumeric/AutoNumeric.js", "~/Scripts/autoNumeric/AutoNumericDefaultSettings.js", "~/Scripts/autoNumeric/AutoNumericEnum.js", "~/Scripts/autoNumeric/AutoNumericEvents.js", "~/Scripts/autoNumeric/AutoNumericHelper.js", "~/Scripts/autoNumeric/AutoNumericOptions.js", "~/Scripts/autoNumeric/AutoNumericOptions.js", "~/Scripts/autoNumeric/main.js"));

  5. For testing purposes add in your HTML input field:

    <input type="text" id="test" value="" placeholder="something">
    
  6. Initialize input field in your file. FOr example your main javascript file is main.js (NOTICE: this main.js is different than main.js in autonumeric folder!):

    $(document).ready(function () {
      // Initialization
       new AutoNumeric('#test', { currencySymbol : '$' });
    })
    

This not works. Question: Should I import ES modules from folder or my main.js 'sees' the autoNumeric/main.js and all of its modules?

MBaas
  • 7,248
  • 6
  • 44
  • 61
Stefan0309
  • 1,602
  • 5
  • 23
  • 61

1 Answers1

1

If you can rely on an internet connection you should probably just use a CDN

Here is the link : https://cdnjs.com/libraries/autonumeric

Simply import it in your body like :

<script src="https://cdnjs.cloudflare.com/ajax/libs/autonumeric/4.1.0/autoNumeric.min.js"></script>

And you should be good using it (don't forget to remove useless files).

Stefan0309
  • 1,602
  • 5
  • 23
  • 61
Baldráni
  • 5,332
  • 7
  • 51
  • 79
  • 1
    Do note that instead of relying on a fixed version, you can just use what the [documentation says](https://github.com/autoNumeric/autoNumeric/#in-the-browser) about that : ``. That way you always get the latest version. – Alex Oct 05 '18 at 06:26