Radio button into images created dynamically?

jsfiddle.net/FsshJ The only downside is that it requires both the img and the input to have IDs. However, you could change it to something else if you wanted/needed to.

jsfiddle.net/FsshJ/ The only downside is that it requires both the img and the input to have IDs. However, you could change it to something else if you wanted/needed to.

Thanks! It is well working! – Charles Lemarier Aug 9 at 19:28.

Try this: $(this). Click(function () { $('input:radioname=subjectagendaactivity'). Attr("checked", true); }).

– ShankarSangoli Aug 9 at 19:17 Thank you for your help, I appreciate it. Problem is solve by Andrew peacock if you want to see how I did, thanks again – Charles Lemarier Aug 9 at 19:34.

$(this). Click(checkIt($(this))); // Elsewhere function checkIt(rBtn) { rBtn. Checked = true; }.

This is not working with my code. – Charles Lemarier Aug 9 at 19:15.

Assuming the checkbox you want to check is always the element before the image you're clicking on: $('img'). Click(function () { var $check = $(this). Prev(':checkbox'); if($check.Is(':checked'){ // Already checked?

Uncheck it! $check. RemoveAttr('checked'); } else{ $check.

Attr('checked','checked'); } }); Take a look at jQuery's traversal methods; you should be able to find one that will allow you to grab your checkboxes by convention.

Try this: $('input:radioname=subjectagendaactivity'). Each(function(index) { if(index == 0) { $(this). Attr("checked","checked"); return; } }).

Not working, telling me $("input:radioname=subjectagendaactivity")0. Attr is not a function – Charles Lemarier Aug 9 at 19:13 updated try it now – kleinohad Aug 9 at 19:22 Still was not working, maybe I was doing something wrong. Thank you anyway problem is solved!

– Charles Lemarier Aug 9 at 19:30.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions