How can I get, manipulate and replace a text node using jQuery?

后端 未结 3 382
时光取名叫无心
时光取名叫无心 2021-01-19 11:41

Here is my code:

  • Printing from $10
  • 3条回答
    •  一整个雨季
      2021-01-19 12:09

      $("li.det_price a").text() would get you the text of that LI (and, unfortunately, of all LI nodes with that class reference). To get just the text of that particular LI you would have to give it an ID, or find some other way to identify it uniquely.

      Once you do identify it uniquely, you could simply put a string in the .text() braces to change what you had. For example,

      $("li.det_price a").text('Not Printing') would change your text above from 'Printing' to 'Not Printing'.

    提交回复
    热议问题