Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding some WET event into ASPX page #8468

Open
joel-ld opened this issue Aug 29, 2018 · 3 comments
Open

Adding some WET event into ASPX page #8468

joel-ld opened this issue Aug 29, 2018 · 3 comments
Labels
Query: Question State: Resolved An acceptable solution have been provided.

Comments

@joel-ld
Copy link

joel-ld commented Aug 29, 2018

Hello,

We're getting some issue with adding some WET event into an ASPX page.

Basically, we need to add some JQuery code into the middle of a page.

Example:

$( document ).on( "wb-ready.wb", function( event ) {

	$(".someClass").InitilializePlugin();
	functionFoo();
});

Actually, because this code is in the middle of the body, the code into the wb-ready.wb is never reached.

Do you have any best practice to accomplish that.

Thank a lot.

Joel

@RobJohnston
Copy link
Contributor

I'm guessing that it's not working because jQuery isn't loaded until the end of the page? If so, could you put the script into an external file and use the defer attribute, as in <script defer src='myfile.js'>?

@duboisp
Copy link
Member

duboisp commented Aug 30, 2018

Another solution will be to insert your javascript after the wet-boew.js script

@joel-ld
Copy link
Author

joel-ld commented Aug 30, 2018

That's what I thought.

In MVC we can add @section scripts { } into the CSHTML page and place the section rendering event at the end of the layout page.

Howerver in Webforms, there is no easy way to achieve that.

Thanks

@duboisp duboisp added the State: Resolved An acceptable solution have been provided. label Aug 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Query: Question State: Resolved An acceptable solution have been provided.
Projects
None yet
Development

No branches or pull requests

3 participants