jQuery - if element text matches statement, change the matched text -
What are the ideas given below I am trying to achieve though I know that < Code> $ (this) is not working like this, I do not know what I'm trying to do: HTML: I like it if the text of the element matches £ 0.00, then "see the product". I hope this makes sense. You can do a function by: When you pass in a function, jQuery will call a function once for each element, and set the text of the element that you will return. (Note that the first argument is the index, which you will not use, the second is what you want.)
if ($ ('value') Text () || $ ('productcrease'). Text () == "£ 0.00") {$ (this) .text ('see product'); }
& lt; P class = "value" & gt; One £ 0.00 & lt; / P & gt; or
& lt; P class = "productprice" & gt; One £ 0.00 & lt; / P & gt;
$ ('value, .productprice'). Text (work (index, text) {return! Text || text == "£ 0.00"? "See product": text;});
Comments
Post a Comment