I’ve been working on the modification of an iframe using javascript. The iframe contains this form
What I want to be able to do is retrieve information from the label; however it doesn’t have an ID. is there any way I could get javascript to get the input button by ID, and have it analyze the label assigned to it?
casablanca’s way is the best way if you only know the button ID.
Depending on what else you might know, other things might be quicker. If, for instance, you know that it is inside a DIV that you know the ID of, and you know that it is the only label inside that DIV, then you could do something like
If you know that it’ll always be the only label with the same parent as your button, you could write
Basically, a broad set of solutions might be optimal depending on what assumptions you can afford to make. If you only know what you’ve told us in the question, then casablanca’s iteration is the way to go.