I am having some serious problems with jquery mobile, I am making a learning deputation system. Now I dynamically Question page Everyone wants to populate a question to answer the time. So far, I have been able to do all this but at present my radio buttons are refusing to follow the normal jquery order when I call them dynamically. When I dynamically interfere with the design, but when I work hard then I hope what I really want. The image below is an example of an instrument that is trying to explain I
var possibleAnswers = poss_ans.split ("I", "); // poss_ans string in which all the databases The answer is (var i = 0; i & lt; probable answer; long; i ++) {var label = sp [i]; $ radio = $ ('& lt; input / & gt;', {type: "Radio"}); Var $ label = $ ('& lt; label / & gt;', {text: label}); Var wrapper = $ (' Please sorry it is my html but in fact with Bella Good I did not post there, so I did not post it here.
& gt; input type = "radio" name = "radio-choice-1" id = "Radio-choice-2" value = "option-2" /> & Lt; Label = "radio-choice-2" & gt; 6 & lt; / Label & gt; & Lt; Input type = "radio" name = "radio-choice-1" id = "radio-choice-3" value = "choice-3" /> & Lt; Label = "radio-choice-3" & gt; 4 & lt; / Label & gt; & Lt; Input type = "radio" name = "radio-choice-1" id = "radio-choice-3" value = "choice-3" /> & Lt; Label = "radio-election-3" & gt; 8 & lt; / Label & gt; & Lt; Input type = "radio" name = "radio-option-1" id = "radio-choice-3" value = "choice-3" /> & Lt; Label = "radio-choice-3" & gt; 2 & lt; / Label & gt; & Lt; / Fieldset & gt; & Lt; / Div & gt; & Lt; / Div & gt; Any help or contribution will be thankful to everyone. Thanks
For jQuery mobile, you need to initialize widgets or refresh them after adding control, dynamically apply jQM classes. For your case, you make HTML easy. Can:
& lt; H1 id = "title" & gt; H1 Headings & lt; / H1> & Lt; P id = "question" & gt; Question & lt; / P & gt; & Lt; Fieldset data-role = "control group" & gt; & Lt; Div id = "poss_ans" & gt; & Lt; / Div & gt; & Lt; / Fieldset & gt;
Then in the script you need to add a name to the radio button so that one can check the others unchecked. Also add an ID and label for those points on the related ID Finally, after all the insertion, call the version () to initialize the design to initialize the checkboxed widgets, and then tell the controlgram field to refresh itself. .
var $ posans = $ ('# poss_ans'); (Var i = 0; i & lt; possible Answers.length; i ++) {var label = potential greetings [i]; $ Radio = $ ('& lt; input / & gt;', {id: 'rad' + i, name: 'possible answer', type: "radio", value: possible greetings [i],}); Var $ label = $ ('& lt; label / & gt;', {for: 'rad' + i, text: label}}; $ Posans.append ($ label) .append ($ radio); } $ Posans.enhanceWithin (). Closest ("field"). Control group ("refresh");
No comments:
Post a Comment