It looks like your version uses a numeric value as determined by the order of the P tag. This is what I had before.
The second version generates a Key for the paragraph so it can be moved anywhere in the page, and survive slight modifications if the text changes too.
It's simpler, of course. It's in plain JS and as jQuery plugin