[jQuery] this.remove

2009-10-19 Thread Krommenaas

I was wondering why in a link's click event...
  $('a.').click( function() {

this won't work...
   this.remove()

but this does work...
  $('#'+this.id).remove();

as will this...
$('a[name='+this.name+']').remove();

It's not a problem since I have these work-arounds, I'm just trying to
understand why this.remove() doesn't work. Tia.


[jQuery] Re: this.remove

2009-10-19 Thread Krommenaas

get it, thx guys!


[jQuery] Re: Event code in different .js files

2009-01-19 Thread Krommenaas

is this also true of document.ready?


On Jan 14, 9:24 pm, Ricardo Tomasi ricardob...@gmail.com wrote:
 In the old-fashioned you couldn't have more than one event handler:

 window.onload = function(){ .. }

 but using jQuery's bind('load', function(){}) you're using the new
 standards-based event system, via addEventListener (attachEvent on
 IE), in which 'onload' is not a property of the window object, instead
 you assign listeners that fire with the event. You can have as many
 of them as you like.

 cheers,
 - ricardo


[jQuery] Re: Event code in different .js files

2009-01-14 Thread Krommenaas

strange, but I should have checked. thanks!


[jQuery] Event code in different .js files

2009-01-13 Thread Krommenaas

I'm relatively new to jQuery and ran into a problem. I use a framework
(CakePHP) and want some of my jQuery to be included by the layout (the
general template for the site) and some by the current view (which is
page specific). This means the actual html page will use two (or
more) .js files.

I need to put everything in $(window).bind('load', function () {}  to
make sure my jQuery is executed after loading all images. However, I
assume if I do this in two different .js files, the second one will
replace the first one. So the question: how can I use $(window).bind
('load', function () {} in multiple .js files?