Jump to content

creating custom event


simpli

Recommended Posts

Hi,

I think I need to create a custom even when the table I'm building is done loading so I can collapse the different tbodys in it. Can anyone has a simple example of an event creation and further usage? I tried finding some in the internet but they look either fishy or complicated.

 

Thanks,

J-R

Link to comment
https://forums.phpfreaks.com/topic/152711-creating-custom-event/
Share on other sites

There's no way to create a custom event without modifying browser code.  (Well, technically, you could but it would have to rely on other events and involve looping.)

 

 

You could just put JS code right after the table, by the way.  You could also just use a document.onload.

 

 

Or, with a framework like jQuery, you could do onready.

if you use jquery (if you don't you should!) http://docs.jquery.com/Events/load#fn...

 

$('table').load(function(){

...

};

);

 

obviously that would run on ALL tables in your page so you can make it more specific with a class or id or what ever you choose..

You can attach events with jQuery?  Hrmmm, I think I knew that at some point, but I forgot it.  I wonder if there is some method I don't know about to attach an event to a DOM object or something, or if jQuery just loops or something.  I would imagine there's a method I don't know about since script execution would hang if not.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.