In this example, I would like to find all span class of "server-error". I think I am able to do that and store in an array. But here is where it gets tricky for me...

Is there a way of appending the value = "123456" to a text file for every "server-error" I locate?

I am a noob, and have searched around but can't find anything definitive. Any help would be greatly appreciated :)!

                <label><input type="text" value="123456" name="specificNum"></label>


                <label><input type="text" value="1" name="allowIn"></label>


                        <span class="server-error">
                            Invalid Number

        <td class="centered"><a href="#" class="deleteRow">Remove</a></td>
  • What do you mean by "appending the value ... to a text file for every ..."? Could you extend your question with a sample example of this text file you are looking for? – João Farias Sep 18 at 4:49
  • This text file will be something I create and kept as a manifest on my end to log every "value" that has a "server-error". There will be multiple of these instances throughout the html. I just don't know how to traverse back after hitting on "server-error" to log the "value". – mikec Sep 18 at 15:27
  • The labels with an input that has a value attribute are on the same level that the span.server-error, which makes a bit weird to associate the span.server-error with a label. In the example above do you want to keep the value="1" and not the value="123456"? Do you want to associate always the immediately previous label from a span.server-error? – João Farias Sep 18 at 15:36
  • Thanks for the response again. I would only like to associate "value" when "name" is equal to "specificNum". In this case, it would not be the previous label. Yeah, I am in confusion of how to gather that data currently. – mikec Sep 18 at 23:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.