jQuery - radiobutton gets unselected

I have one last problem with this code....

1. You can see the code here https://drive.google.com/open?id=1uZAdMSnw0QrfjJbhijqeDu2NQTk5wFi4
click on page.html

2.  Page loads and you see the radiobutton checked
r1.png
3. Click on Add and another row is added but now, the first radiobutton is unchecked.
r2.png
4. I checked the "id" and "name" and they're unique. Not sure why this is happening. I'll continue working on it. If I figure it out, I'll post back.
LVL 8
CamilliaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

leakim971PluritechnicianCommented:
radio button with the same name are exclusive (mean if one is checked the previous one with the same name is unchecked)
when you append the template, you add radio button with the same name ( index 0 ) so the previous one (the first one is unchecked)
just remove the name attribute and as you're cloning, don't put ID attribute inside your template too. It's just a good practice to not use the ID attribute useless in your case.

so just replace :
								<div class="radio">


																<label>

																	<input type="radio" id="Schedules[0]IsExcelExportCSV" value="false" name="Schedules[0].IsExcelExport" class="radio1">
																	CSV
																</label>

															</div>
															<div class="radio">
																<label>
																	<input type="radio" id="Schedules[0]IsExcelExportExcel" checked="checked" value="true" name="Schedules[0].IsExcelExport" class="radio2">
																	Excel
																</label>

															</div>

Open in new window

by :
					<div class="radio">
						<label>
							<input type="radio" value="false" class="radio1">
							CSV
						</label>
					</div>
					<div class="radio">
						<label>
							<input type="radio" checked="checked" value="true" class="radio2">
							Excel
						</label>
					</div>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CamilliaAuthor Commented:
Let me see.
0
CamilliaAuthor Commented:
Don't think it's working right but let me play around with it. I'll post back.
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

leakim971PluritechnicianCommented:
work fine on my side...
0
CamilliaAuthor Commented:
Let me try it again.
0
CamilliaAuthor Commented:
Works. I think I needed to clear the cache. Thanks agian.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.