Copy the background from one element to another using jQuery not working in Firefox.

Here's jsfiddle - http://jsfiddle.net/XcC5d/1/

$('.select').on('click', function(event){
    $('.result').css('background', $(event.target).css('background'));
});

When you click on any of the first 3.select divs, it copies the css value of the background and sets it to the result with a red frame.

This works in safari and chrome, but not in firefox. Any help would be greatly appreciated.

+3
source share
2 answers

Try the following:

$('.select').on('click', function(event){
    $('.result').css('background', $(event.target).css('background-image'));
});
+3
source

You must set the background-image property for CSS. For example: Updating your violin

$('.select').on('click', function(event){
    $('.result').css('background', $(event.target).css('background-image'));
});

Edit: Damn, a few seconds is too late :)

+1
source

All Articles