stracqan
asked on
How can I change the image of a specific Radio Button group using jQuery?
Hello,
I found an example about how to change the skin on a radio button group here:
http://widowmaker.kiev.ua/checkbox/
What I would like to do is only have the image show for a specific radio button group on the page. In other words, I have several radio button groups on my page, but I only want to skin one group.
I narrowed it down to the below code that captures all radio buttons on the page.
Any ideas???
Thank you very much in advance!!!!!
I found an example about how to change the skin on a radio button group here:
http://widowmaker.kiev.ua/checkbox/
What I would like to do is only have the image show for a specific radio button group on the page. In other words, I have several radio button groups on my page, but I only want to skin one group.
I narrowed it down to the below code that captures all radio buttons on the page.
Any ideas???
Thank you very much in advance!!!!!
<script type="text/javascript">
$(document).ready(function() {
$('input:radio').checkbox();
});
displayForm = function (elementId)
{
var content = [];
$('#' + elementId + ' input').each(function(){
var el = $(this);
if ( (el.attr('type').toLowerCase() == 'radio'))
{
if ( this.checked )
content.push([
'"', el.attr('name'), '": ',
'value="', ( this.value ), '"',
( this.disabled ? ', disabled' : '' )
].join(''));
}
else
content.push([
'"', el.attr('name'), '": ',
( this.checked ? 'checked' : 'not checked' ),
( this.disabled ? ', disabled' : '' )
].join(''));
});
alert(content.join('\n'));
}
changeStyle = function(skin)
{
jQuery('#myform :checkbox').checkbox((skin ? {cls: skin} : {}));
}
</script>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I used the second example and it works great!!! thank you!!!!!!
You're welcome! Thanks a lot for the points!
mean : set a class and use the class selector :