What you are looking for is "event delegation".
In your last version, you are attaching a "click" event handler to
every you add to your table. It can be time and resource
consuming.
A better way is to bind the "click" event to the container where you
will load your dynamic content and wait for
Now Im get confused...
Wil, Is the code that you suggested equal that I wrote?
Mine
$("#tb a").click(function() {
alert(this.id);
});
Wil
$("#tb a").click(function() {
alert('Test');
});
Tks
Have you tried simply doing:
$("#tb a").click(function() {
alert('Test');
});
Depending on the table's code ">" will break your heart...
Wil
On Wed, Nov 18, 2009 at 4:25 AM, Denis Caggiano wrote:
> Hi Greg,
> I'm defined an ID to my table (ID = "tb") that have my report, and
> trying t
The hint of the day:
*The other thing to make sure you're doing is to call your code once*
*the DOM is loaded*
*---By Scott*
**
Im using AJAX and defyning the $("#tb a").click before the DOM is loaded and
that was the problem.
Here is my $.post now:
$.post(
'adm_cobranca_ajax.asp',
{ mes:
Hi Greg,
I'm defined an ID to my table (ID = "tb") that have my report, and
trying to code like this:
$("#tb > a").click(function() {
alert('Test');
});
But it doesnt working.
In other words, how can I define that all in my table triggers an
event when clicked?
Tks
5 matches
Mail list logo