Thursday, March 28, 2013

jQuery Misc



jQuery :



how do you write the $(document) funcion call ?

$('document').loaded()
$(document).onload()
$(document).onready()
$(document).ready()
$("document).ready()

$(document).ready() is the correct option


detach,remove and replaceWith

Difference in detach and remove : detach keeps the removed item around so that it can be reattached.
remove altogether removes the item
replaceWith : removes the earlier content and inserts new in its place


what is jQuery animation ?
jQuery animation is achieved by using jQuery.animate function. The functions takes a css property , duration, easing and completion callback

property - any valid css property like height, width, color etc.
duration - duration in milliseconds
easing - swing  or linear
completion - completion callback





what is the difference in window and document ?

window is viewable area of the browser
document is the entire HTML document.

So when there is a vertical scrollbar, document has more height that window.

document is also available as window.document.
document contains entire DOM elements
getElementByName/getElementById is supported by document, not by window





gridview hovering sample
        $(document).ready(function() {
        $("#<%=GridView1.ClientID%> ").hover(
            function() {
                $(this).css("background-color", "red");
            },
            function() {
                $(this).css("background-color", "blue");
            }
           
            );
        });

No comments:

Post a Comment