0
Ich habe folgende jQuery-Code.Teilung von Text in Jquery
innerHtml = innerHtml + '<div class="compare-box '+ $(this).attr("offertype") +'"> <div class="compare-close"><span class="closed" onclick="RemoveCompareOffer(\''+ $(this).attr("id") + '\')"><i class="fa fa-times"></i></span></div>'
+ '<div class="compare-logo"><img src="' + $(this).attr("imagelink") + '" /></div><p>' + $(this).attr("offername") + '</p>'
+ '<input type="button" value="View Details" class="viewbtn" onclick="CallOfferRenderAction(\'' + $(this).attr("offercode") + '\',\'' + $(this).attr("providercode") + '\')" /></div>';
Wenn $(this).attr("offertype")
enthält special-box specialoffer
ich teilen wollen und ersetzen Sie es mit specialoffer-compare
. Wie kann ich das machen?
was u teilen wollen und ersetzen mit dem String für besondere Box oder Special –
I Spezial-Box entfernen möchten , halten Sie specialoffer und fügen Sie "-compare" an specialoffer –
an, verwenden Sie eine Variable wie gezeigt ... 'var temp = $ (this) .attr (" offertype "); temp = temp.indexOf (" special-box specialoffer ")> -1? "specialoffer-compare": temp; innerHtml = innerHtml + ... + temp + .... ' –