I am having below code to send the value of radio button people have clicked via ajax. But it however only works on the first set of options I give. After the the user press next link and all the options are changed and new one loaeded through ajax. But on that this selector is not working.
$(".options input").click(function(){
var ans = $(this).val();
$.post("sessions", { action: "set_answer", answer: ans, question: qid },
function(data) {
alert("Data Loaded: " + data);
});
});
What is the possible solution? Below is how the options are.
<div class="options">
<input id="1"type="radio" name="answer" value="Two" />Two<br/>
<input id="2"type="radio" name="answer" value="One" />One<br/>
<input id="3"type="radio" name="answer" value="Four" />Four<br/>
<input id="4"type="radio" name="answer" value="Five" />Five<br/>
<input id="5"type="radio" name="answer" value="Six" />Six<br/>
</div>
If latest jQuery,
Or you could try doing:
Hope it helps