[jQuery] Re: How to apply jQuery to an item which doesn't exist when the page is loaded.
You need to bind an event handler to your button after you've created it. I would suggest you look at the click() method in the jQuery docs for ideas and examples of how to manage that. Rey... lukas wrote: My PHP code creates a button which doesn't exist when my page is loaded. Hence, the according jQuery command doesn't work. How can I fix this? Thank you!
[jQuery] Re: How to apply jQuery to an item which doesn't exist when the page is loaded.
If you use the livequery plugin, it will apply trigger events like click on element that are not available when the dom is first loaded. On Fri, Sep 5, 2008 at 10:49 AM, lukas [EMAIL PROTECTED] wrote: My PHP code creates a button which doesn't exist when my page is loaded. Hence, the according jQuery command doesn't work. How can I fix this? Thank you!
[jQuery] Re: How to apply jQuery to an item which doesn't exist when the page is loaded.
On Fri, 5 Sep 2008, lukas wrote: My PHP code creates a button which doesn't exist when my page is loaded. Hence, the according jQuery command doesn't work. Not sure what you meant. For server-side scripting - such as PHP - loading a page is the only way for the script to create HTML objects - including buttons. So what you said does not make any sense. Are you talking about XMLHttpRequest / AJAX request? Maybe you should point to an example page + source. -- (stephan paul) Arif Sahari Wibowo _ _ _ _ / // // / _/ / // _/ http://www.arifsaha.com/
[jQuery] Re: How to apply jQuery to an item which doesn't exist when the page is loaded.
Look at the livequery plugin. On Sep 5, 3:49 pm, lukas [EMAIL PROTECTED] wrote: My PHP code creates a button which doesn't exist when my page is loaded. Hence, the according jQuery command doesn't work. How can I fix this? Thank you!
[jQuery] Re: How to apply jQuery to an item which doesn't exist when the page is loaded.
Thank you. I added LiveQuery but get the error message in Firebug: jQuery(.inputsubmit).livequery is not a function my code: jQuery(document).ready(function(){ jQuery(.inputsubmit).livequery('click', function(event){ var id = 'reply_form_' + this.id; jQuery(#+id).toggle(); }); }); On Sep 5, 10:59 am, Ryan Zec [EMAIL PROTECTED] wrote: If you use the livequery plugin, it will apply trigger events like click on element that are not available when the dom is first loaded. On Fri, Sep 5, 2008 at 10:49 AM, lukas [EMAIL PROTECTED] wrote: My PHP code creates a button which doesn't exist when my page is loaded. Hence, the according jQuery command doesn't work. How can I fix this? Thank you!
[jQuery] Re: How to apply jQuery to an item which doesn't exist when the page is loaded.
Yeah, this doesn't make sense. Either the HTML is served (exists) or it's created on the fly in some way later on by JavaScript. On Sep 5, 8:01 am, S P Arif Sahari Wibowo [EMAIL PROTECTED] wrote: On Fri, 5 Sep 2008, lukas wrote: My PHP code creates a button which doesn't exist when my page is loaded. Hence, the according jQuery command doesn't work. Not sure what you meant. For server-side scripting - such as PHP - loading a page is the only way for the script to create HTML objects - including buttons. So what you said does not make any sense. Are you talking about XMLHttpRequest / AJAX request? Maybe you should point to an example page + source. -- (stephan paul) Arif Sahari Wibowo _ _ _ _ / // // / _/ / / / _/ http://www.arifsaha.com/