Java Script Action in Nano Flow

2
We need to use jQuery functions and elements inside a Javascript action in a Nano flow. This isn't possible currently as the browser displays jQuery as undefined. Can you suggest us the import library or the method/way to use jQuery. E.g. $('.single-search-btn-new').on( "click", function() { $( ".search-container" ).slideToggle("slow"); $( ".grid-table.header" ).toggleClass("removeBefore"); });
asked
2 answers
2

Easiest way would be to add jQuery in a separate folder and load it via the index.html. I would like to say though, try to refrain from jQuery and use plain JavaScript if possible. If I look at your above code, this is easily transformed to plain JavaScript. Then no need to add an extra dependency in your project. jQuery is used in different versions in many widgets, so if you use many widgets, you will probably get a conflict somewhere in the future. 

answered
4

Dear Mohammed,

Please reconsider not use jQuery at all. jQuery is does not play well with others and can cause conflicts with other widgets (who also should no use jquery) Besides that, it adds an other file for download, affecting user performance.

If you are willing to up your JavaScript skill have a look at http://youmightnotneedjquery.com/ for quick snippets. 

Though if you are really hooked to the jQueyr selector, have a look at https://github.com/kenwheeler/cash as an alternative.

Cheers, Andries

answered