Skip to content Skip to sidebar Skip to footer

Laravel 5 Mix App.js File Creation

I created a custom JavaScript file with a simple function: function picture(soemthing){ document.getElementById('idXYZ').src = 'example.com'; } Then I added this file to the

Solution 1:

The functions and classes are not exposed to the public, so all JavaScript logic should be written in the JS files. If you insist on writing JavaScript logic in the blade file, you could attach the function to the window object.

window.picture = function picture(soemthing){
    document.getElementById('idXYZ').src = "example.com";
}

...

window.picture()

Post a Comment for "Laravel 5 Mix App.js File Creation"