How can I change the image of a specific Radio Button group using jQuery?

stracqan
stracqan used Ask the Experts™
on
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!!!!!
<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>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Multitechnician
Top Expert 2014
Commented:
set a class selector : $(".theClassNameOfThegroup").checkbox();

or use the group name : $("input:radio[name='theGroupName']").checkbox();
leakim971Multitechnician
Top Expert 2014

Commented:
set a class selector
mean : set a class and use the class selector :

Author

Commented:
I used the second example and it works great!!! thank you!!!!!!
leakim971Multitechnician
Top Expert 2014

Commented:
You're welcome! Thanks a lot for the points!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial