javascript - Get one value of anchor tag -


मेरे पास ऐसा html कोड है

  & lt; article & gt; & Lt; h4 & gt; Lorem Ipsum & lt; / h4 & gt; लेबल: & lt; a href = "#" & gt; चित्र & lt; / a & gt ;, & lt; a href = "#" & gt; पैनोरमा & lt; / a & gt; स्पैन क्लास = "पोस्ट-लेबल्स" & gt; लेबल: & lt; a href = "#" & gt; ;, & lt; / span & gt; & Lt; / लेख & gt; & LT; लेख & gt; & Lt; h4 & gt; Lorem Ipsum & lt; / h4 & gt; लेबल: & lt; span class = "post-labels" & gt; लेबल: & lt; a href = "#" & gt; फ़ोटो & lt; / a & gt ;, & lt; / span & gt; & Lt; / लेख & gt;   

मुझे jquery में मूल्य (चित्र, फोटो) मिलना चाहिए और आलेख के वर्ग के लिए मूल्य जोड़ें

  $ ('आलेख')। प्रत्येक (फ़ंक्शन () {if ($ (this) .find ('post-labels')। लंबाई) { Var cl = $ ('a')। पाठ (); $ (यह) .addClass (cl);}});    

पहले एंकर पाने के लिए जिसे आप उपयोग करना चाहते हैं:

  $ ('article')। प्रत्येक (function () {if ($ (this) .find ('post-labels')। लंबाई) {var cl = $ (this) .find ('post- लेबल & gt; a ')। Eq (0) .text (); $ (this) .addClass (cl);}});    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -