jQuery question: sibling element selector
Hello, all,
I'm working on a project that will test the links on every page to make sure they all work. I won't go into detail on what it's doing, but I need help on displaying the statusCode that is returned as a result.
I'm dynamically building something like the following:
<div class="linebyline">
<div class="leftDiv" id="status_0">?</div>
<div class="rightDiv" id="url_0">https://www.google.com</div>
</div>
<div class="linebyline">
<div class="leftDiv" id="status_1">?</div>
<div class="rightDiv" id="url_1">https://www.yahoo.com</div>
</div>
<div class="linebyline">
<div class="leftDiv" id="status_2">?</div>
<div class="rightDiv" id="url_2">https://www.sddc.com</div>
</div>
Now, after this is built, I'm grabbing the URL in the rightDiv div, using $.ajax() to get the page, and I'm getting the xhr.status. I can alert it, no problem. But what I'm trying to do is get the leftDiv that is within the same wrapper linebyline div to set the html() value.
The following is _not_ working:
).done(function(data,statusText,xhr){
$.prev('.leftDiv').html(xhr.status);
});
What is the best way to get the proper leftDiv element???
V/r,
^ _ ^
PS.. I also tried $(this).prev('.leftDiv'), but that didn't work, either.
