Created
July 4, 2018 22:02
-
-
Save rparsi/afe22f898321a80d9e2aafec95519844 to your computer and use it in GitHub Desktop.
loading js inline in phtml file with requirejs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script> | |
| require(['domReady', 'jquery', 'http://you.can.also.use.urls/blah.js'], function (domReady, $, blah) { | |
| domReady(function () { | |
| // do jquery stuff, among other things | |
| $("#form-validate").css('display', 'none'); | |
| var forgot = $('forgotPasswordLink'); | |
| var forgotEmail = $('email_address'); | |
| $(forgot).on('click', function(event){ | |
| event.preventDefault(); | |
| $("#form-validate").css('display', 'unset'); | |
| $(forgotEmail).val($('email').val()); | |
| }); | |
| // do something with object 'blah', assuming whatever external js you load returns | |
| // an object or function (to requirejs) | |
| }); | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment