How to change multiple same name input element in Wordpress post with jQuery?

Viewed 88

I can change Wordpress input element with different name. As for example the following input element:

<input class="wpProQuiz_button" type="button" value="Start Quiz" name="startQuiz">

can be changed with the following jQuery code:

jQuery("input[name='startQuiz']").attr("value", "Start Mock Test");

Question:

How can I do the same for the following with same name input element in Wordpress?

<input type="button" name="next" value="Next" class="wpProQuiz_button wpProQuiz_QuestionButton" style="float: right;">

<input type="button" name="next" value="Quiz-summary" class="wpProQuiz_button wpProQuiz_QuestionButton" style="float: right;">

I have use the following for the above two input element like :

jQuery("input[name='next']").attr("value", "Next");
jQuery("input[name='next']").attr("value", "Test-summary");

But it is not working. How can I do this?

1 Answers
Related