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

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -