के साथ jQuery रैप आईएमजी हैलो, अगर कक्षा में एंकर है तो मैं एंकर के साथ एक छवि को लपेटने की कोशिश कर रहा हूं।एंकर
jQuery:
if ($(".views-row:has(a)").length) {
var noderef = $(this).attr("anchor");
$(".views-field-field-teaserbox-fid img").wrap("[anchor = "'+noderef+'" ]");
}
HTML:
<div class="view-content">
<div class="views-row">
<div class="views-field-field-node-ref-nid">
<span class="field-content"><a class="active" href="/all-essentials-inspiring-events">All the essentials of inspiring events.</a></span>
</div>
<div class="views-field-field-teaserbox-fid">
<span class="field-content"><img width="208" height="137" src="http://localhost:8888/sites/default/files/wedding_Giveaway_teaser.jpg?1283880578" alt="" class="imagefield imagefield-field_teaserbox"></span>
</div>
इसके अलावा, मैं एक डबल या एकल उद्धरण का उपयोग कर किया जाना चाहिए?
'.wrapAll()' फ़ंक्शन के बाईं ओर तत्व को लपेटता है, इसलिए इससे कुछ अमान्य HTML बन जाएगा :) –
@ निक ओप्स ...। –
यी, मैंने आपके कोड की कोशिश की और यह काम नहीं कर रहा है। मैं – arkjoseph