Can I refer to the object within jQuery chain using this keyword? -


Let me say that & lt; P & gt; A numeric character should be increased in the tag. Is it possible to use something like this down?

  $ ('p'). Text (parse int ("this") + 1);   

It does not seem that this refers to the same object when I do the example below:

  $ ('P') Text ($ (this) .height ()). // print $ 731 ('P'). Text ($ (this) .text ()); // Change to empty    

Yes, but you have to use an anonymous function :

  $ ('p'). Text is the index of element (i, t) {// i element of the collection, // if there is an element then // is text. Assuming that the first text-letter is a valid number: return parasont (t, 10) + 1;});    

Comments

Popular posts from this blog

How can I add a seperate action listener to all 14 of my buttons at once that can determine player turn?(java) -

php - Sorting an multidimension array using usort fails -

Simple file compression in C -