background image
HomeRecent PostsDrupalSearchTagsRSSContactAboutAccount

Using jQuery to change the CSS for CCK radio widgets to inline

Eric.London's picture

Here's how you can change the layout of CCK radio widgets to inline using jQuery

<?php
$(document).ready(function(){
  $(
"form#node-form div.form-item div.form-radios div.form-item").css('display', 'inline');
});
?>

In my case, I wanted to change this layout for only one form. Unfortunately, there were not enough unique selectors assigned to the form elements, so I used a jQuery attribute selector to limit the match by the form's action.

<?php
$(document).ready(function(){
  $(
"form#node-form[@action='/MYPATH'] div.form-item div.form-radios div.form-item").css('display', 'inline');
});
?>