STP38
STP38

Reputation: 331

jQuery css coloring won't work

I am practicing jQuery, but I can't seem to fix the CSS background. I'm trying to make like this but with different color:

http://jqueryui.com/sortable/

Here is my fiddle:

http://fiddle.jshell.net/HAZ3n/

Only jQuery code:

$(document).ready(function(){

    $( "#sortable" ).sortable();
    $( "#sortable" ).css({
        background-color: '#000'
    });
    $( "#sortable" ).disableSelection();
});

I've tried to change the position too but same result, it won't load I think?

EDIT: Version: jQuery 1.9.1 jQuery UI 1.9.2

Upvotes: 1

Views: 507

Answers (3)

Kawinesh S K
Kawinesh S K

Reputation: 3220

$( "#sortable" ).css({
    'background-color': '#000'
});

Updated Fiddle

To change the inside div colors

 $( "#sortable .ui-state-default" ).css({
        'background': '#efefef'
    });

Inner Div Fiddle

Upvotes: 0

Luke
Luke

Reputation: 340

Here is a correct fiddle also with fixed span positioning. http://fiddle.jshell.net/HAZ3n/7/

$( "#sortable .ui-state-default" ).css({
    background: '#000'
});

Upvotes: 0

chridam
chridam

Reputation: 103425

Try

$("#sortable" ).css({
   'background-color': '#000'
})

You simply forgot to put quotes on your property. You don't need to pass over a map/object to set only one property. You can just put pass it as string.

Updated JSFiddle

Upvotes: 2

Related Questions