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
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
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:
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
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
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;}
6 matches
Mail list logo