How to add script onLoad?

I need to add Javascript onLoad to the tag: I have a form and I want to disable input at startup.

How can I do this with symfony? I should only do this for forms, so I cannot add it to the layout tag

+3
source share
1 answer

You can use view.yml to add js script only to views containing forms. Like this:

yourViewSuccess:
  javascripts: [yourscript.js]

If you want to use onload or onready, see this link: http://docs.jquery.com/How_jQuery_Works#Launching_Code_on_Document_Ready

0
source

Source: https://habr.com/ru/post/1756180/


All Articles