jquery - Execute JavaScript function with externally loaded link -


I will accept that the title is a bit confusing but it is difficult to come up with the best one.

OK, so I have 3 pages, the first is the main page that the user loads and the second 2 which is going to load in the main page with JEL.

Here is the JavaScript code on the first page:

  $ (document) .ready (function () {$ ("# mainWrap"). CSS ({width: 300px ", height:" $ ("[Name = loadRegisterForm] '). (Function () {$ (" # mainWrap "); $ (" # mainWrap "); $ (" module / web / loginForm.php "); $ ('[Name = loadRegisterForm]') .load (" module / web / registerf.php ");});});  

Firstly in this page The entry loads the form and then he hears for a link that will be loaded by the register form when loaded.

Link Login For I am in the load which is loaded, but unfortunately this does not work. What am I doing wrong?

I have tried to put a link on the main page with the javascript code and it works Is it just the fact that the link loading after javascript is loading, is it not working?

You need a callback function for the first load call. Calls, where you $ ( '[name = loadRegisterForm]') will set the click handler for element in fact, does not exist until the completion of a handler binding that preloaded.

$ (document) .ready (function () {$ ("# mainWrap") CSS ({width: "300px", height: "200px"}); $ ("# mainWrap "). Load (" module / web / loginForm.php ", blank, onLoadComplete);}); Load on function () {$ ('[name = loadRegisterForm]'). Click (function () {$ ("# mainWrap"). Load ("module / web / registerForm.php");}); }

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -