[jQuery] Re: Overriding extended plugin variables

2008-03-25 Thread meeboo
Well it seems as if you can't override values with null as options. Is this expected behaviour? meeboo wrote: Hi all I have a plugin which has a couple of variables which can be overriden like this: $.fn.doStuff.defaults.classOdd = 'oddClass'; $.fn.doStuff.defaults.classEven

[jQuery] Re[jQuery] moving dynamically added elements

2008-02-15 Thread meeboo
Hey all How can I when dynamically adding a new element also bind a click event to another element which removes it? //Here's what I have so far, redundant code is omitted $.fn.addElement = function(options) { //Redundant code omitted this.prepend($elementToAdd); //dynamically create

[jQuery] Dynamically prepending elements to a div

2008-02-14 Thread meeboo
Hey all In this example, how come I can't prepend the paragraph to the div more than once? $(#adder).click(function() { $('#container').prepend($('#content')); }); # Add content div id=container/div p id=contentcontent/p -- View this message in context:

[jQuery] Re: Dynamically prepending elements to a div

2008-02-14 Thread meeboo
Solved it, it seems as if prepend moves the element instead of copying it. So when trying to add the element a second time you just end up moving the element to the exact position it's located. meeboo wrote: Hey all In this example, how come I can't prepend the paragraph to the div more

[jQuery] Re: Dynamically prepending elements to a div

2008-02-14 Thread meeboo
Problem solved by cloning the element which is to be added, like this. $(#adder).click(function() { var $elementToBeAdded = $('#content').clone(); $('#container').prepend($elementToBeAdded); }); easy peasy meeboo wrote: Hey all In this example, how come I can't prepend

[jQuery] toggleClass weird behaviour

2008-02-08 Thread meeboo
Hey all! I'm wondering why the following code will toggle the div 'divRed' to a different color, but it won't toggle the color for 'divGreen'. style div {height: 100px; width: 100px;} .divRed {background-color: red;} .divGray {background-color: gray;}