我有此代碼段,從而未能在VAR鏈接:jQuery的obj.find問題在javascript
var obj = $(this[0]);
var html = obj.html();
var link = html.find('a[href*=/comment/reply]');
這是從提交的表單Ajax響應。什麼我從VAR HTML找回輸出如下:
===><div class="comment-new-success"><a id="new"></a>
<a id="comment-482"></a>
<div class="comment">
<div class="submitted">Submitted by <a href="/user/1" title="View user profile.">NAME</a> on Sun, 07/10/2011 - 12:48.<span class="new"> *new</span></div>
<div class="content clearfix"><p>123123123123122</p>
</div>
<div class="links_box"><ul class="links"><li class="comment_delete first"><a href="/comment/delete/482?token=e1fba5ef1c99c5a3760313b53f582972">delete</a></li>
<li class="comment_edit"><a href="/comment/edit/482">edit</a></li>
<li class="comment_reply last"><a href="/comment/reply/6/482">reply</a></li>
</ul></div></div>
</div><===(string)
如何正確獲得「/評論/回覆/ 6/599」變量作爲在上面的例子中的VAR鏈接。代碼(我認爲)應該很好地工作,但不
實際上,這是我找到了正確的查詢:VAR鏈接= $(本[0])找到( 'comment_reply一個。 ')ATTR(' href' 屬性。 ); – nigma3d