jQuery: How do I get the contents of a span, subtract by 1, and replace contents of span with new number? -


Assume that I have a PHP loop that removes data that you can delete. I am using AJAX, so when you delete a line, it processes a PHP script and disappears from the row page.

However, I have something like "which is 5 items" when the item is removed, then I have to change that "5", I thought it was the easiest way to subtract from one in javascript.

The problem is, I really do not know how. If someone can point me in the right direction, then it would be great.

Counts with ID 'cnt' Duration:

 < Code> $ ("# cnt"). Text ($ ("# cnt"). Text () - 1)  

Edit:
Secure edition:

  var cntTag = $ ("# cnt: first"); If (cntTag.Length == 1) {var cnt = parseInt (cntTag.text ()); If (! IsNaN (CNT)) {cnt--; CntTag.text (string (cnt)); }}  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -