javascript - jquery select element -
There are some problems with jQuery selectors.
My HTML is similar:
& lt; Form method = "" action = "" & gt; & Lt; P id = "question_1" & gt; & Lt; H1 id = "question" & gt; 1 question & lt; / H1> & Lt; Div id = "options" & gt; & Lt; P id = "option1" & gt; Input A & lt; / P & gt; & Lt; P id = "option2" & gt; Input type = "radio" id = "option" name = "q_2" value = "2" /> gt; B & lt; / P & gt; & Lt; P id = "option3" & gt; Input type = "radio" id = "option" name = "q_3" value = "3" /> c & lt; / P & gt; & Lt; / Div & gt; & Lt; / P & gt; . . . & Lt; / Form & gt;
There are such questions there.
I & lt; P & gt; Examples include 3 radio buttons for each question, for example,
p # question_1 & gt; P # option3p # question_2 & gt; P # option3p # question_3 & gt;
How to do this?
I was trying without any success like this:
$ ("Form p # question_" + i) .filter ("p: eq ( 3) "). AddClass ("true");
I & lt; P & gt;
There is a third radio button for each question. Start with
^
selector nth-child
in this way:
$ ('P [id ^ = "question"]: nth-child (3)'). AddClass ('true');
What is the ^ = "question"
that it selects all the paragraphs starting with question
text in your ID and Then
More info:
-
Comments
Post a Comment