In jQuery, what is selected with $('<div />', {text : $this.attr('title')})? -


well, i'm quite new jquery , while browsing documentation found tutorial on jquery site developing plugins. while reading , trying understand, found can't find answer for. example in section 6.3 data has such code in it:

var $this = $(this),          data = $this.data('tooltip'),          tooltip = $('<div />', {            text : $this.attr('title')          }); 

i understand declaration of several variables on 1 line, however, last 1 - tooltip - 1 i'm interested in. can patient ignorance , explain me content of tooltip variable after processing line?

thank in advance.

it creates new div element, , passes value of $this.attr('title') jquery.fn.text

more information: http://api.jquery.com/jquery/#jquery2

jquery( html, props )

html: string defining single, standalone, html element (e.g. or ).

props: map of attributes, events, , methods call on newly-created element.

and

as of jquery 1.4, second argument can accept map consisting of superset of properties can passed .attr() method. furthermore, event type can passed in, , following jquery methods can called: val, css, html, text, data, width, height, or offset.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -