This code here:
jQuery(function($){
var $button = $('#addrowbutton'),
$row = $('.addrow').clone();
$button.click(function(){
$row.clone().insertBefore( $button );
});
});
Won't work on Firefox but works fine on Chrome & IE.
This is the calling button:
<input type="button" class=button id="addrowbutton" name="addrowbutton" value="Add Row" style="height: 2em;"/>
Any ideas guys? Thanks in advance.
I've put your code in jsfiddle and tested it in Firefox. Works fine for me.
http://jsfiddle.net/nadjib/X48xB/
HTML:
<div class="addrow">Row</div>
<input type="button" class=button id="addrowbutton" name="addrowbutton" value="Add Row" style="height: 2em;" />
jQuery:
var $button = $('#addrowbutton'),
$row = $('.addrow').clone();
$button.click(function () {
$row.clone().insertBefore(this);
});
I'm using "this" instead of $button, because "this" is what you just clicked on (ie the button here).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.