Traversing - $(this).parent().prev().(".replace_no").val("1") - correct way
Hi... I'm trying to traverse using this method... which doesn't work
- $(this).parent().prev().(".replace_no").val("1")
Upon clicking something, I want to change this value:
- <p><label>Replace amount:</label><input type="text" class="replace_no" value="CHANGETHIS" /></p>
- <p><img id="button" src="btn.jpg" /></p>
So I basically want to go to the previous P, then change the value of the class "replace_no" inside here
I've also tried this, which doesn't work:
- $(this).parent().prev( function() {
- $(".replace_no").val("1");
- });
This is ultimately one of the things I just do not understand and I can't seem to find any documentation on it... so I'm assuming its common sense that I do not possess...
Thanks