Javascript – set inline-block css with jquery or javascript

cssjavascriptjquery

based on this example from @Bergi jsfiddle.net/CH9K8/1321/
the code below work fine:

#center{
display:inline-block;
}

but if I try this don't work in Chrome and Safari

$('#center').css('display','inline-block');

nor

document.getElementById('center').style.display='inline-block';

any solution? thanks.

EDIT …
ok now I understand why you say it work fine. I have tried it in Chrome (v30) and safari v5.1 And not work … but yes it work In Explorer, Firefox, and Opera. So now the question is … some solution for Chrome and Safari ?

Best Answer

$('#center').css('display','inline-block');

This works fine as previously stated by PHPglue, (when you actually set the fiddle to use jquery instead of Mootools) the issue with the right div not displaying inline is due to your use of both a float and the display-inline property, they're not really compatible with each other.