Jump to content

jquery, adding content everytime when the button is clicked.


sanjog
 Share

Recommended Posts

Hello, I created a button and have a checkbox form. I want to add that form one by one everytime when the button is clicked,

I have tried by clone() method, it worked but the checkbox didn't work, i mean i couldn't check in the box or it checks in all of the form. I need help.

 

Here is peice of my code...

<html>

<button id="check-type">Multiple choice</button>

 

<div class="multiple-choice">
<input id="check1" type="checkbox" name="check" value="check1">
<label for="check1">ques1</label><br> <br>
<input id="check2" type="checkbox" name="check" value="check2">
<label for="check2">ques2</label><br><br>
</div>
</html>
<script>
$('#check-type').click(function(){
$('.multiple-choice').show(); //shows only once, but i want to add this form everytime when the button is clicked.
});

</script>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...