Saturday, May 30, 2015

hide(), remove(),detach()

hide()

It only sets the display propery of the matched elements to none, all the events, properties, elemetnts and classes remain intact in DOM.

hide() Syntax
$(selector).hide(speed, callback);

...........................................................................................................................................

detach()
detach() method removes all the child and child nodes from the selected elements, but keeps event handlers and data stored which can be reinserted when needed later in the application.

detach() syntax
$(selector).detach();

In order to re-insert a detached element into the DOM, write the returned jQuery set like below from detach() method.

var detachedelment = $('div').detach();
detachedelment.appendTo('body');

...........................................................................................................................................

remove()
This method completely removes the selected element from DOM, including all its texts, classes and events associated with the removed elements. With remove() method, elements data can be restored but not its event handlers as it removes all events and event handlers from DOM.

remove() syntax
$(selector).remove();

Friday, May 29, 2015

Javascript is fantastic language and I love it for the brilliant features and dynamic results that it provides. I have been using javascript since last 6-7 years and no doubt love every part of this.

A lot of developments and changes being taking place place in recent time and many libraries have got developed out of Javascript, like  Angular, jQuery, Prototype, Mootools etc. These libraries originate from Javascript but short and provide excellent support to UI developers. JQuery is in existence since quite some time and provides good features like fading, animation, event controls, browser controls etc. and is used in many applications.

Angular JS is another javascript framework library which is an open source and is google based and free to use. It is much more compact as compared to JQuery and is best preferred in making Single Page Applications(SPA).

As a developer, I feel it responsibility to share whatever I know with the Developers of our community, so have created this blog for this purpose. I would like to update this with the knowledge that I have gathered in so many years and requesting others also to share theirs through this platform.