abc

Share This blog with your friends, so that we can improve more & more . our aim is to easy & simple way of learning.

5/03/2018

Jquery Function & effect on HTML element

hi

today let us continue previous session

1) before() : is use to insert content before perticular element such as insert before div or paragraph

eg: $('#ab'').before('hello hi how are you');

2) prepend() : is use for insert content before all same element

$("p").prepend("<b>hi sample text</b>");

3) append() : similarly use for appending to perticular element
eg:
<script>
$(document).ready(function(){
    $("#ab").click(function(){
        $(".div").append(" <b>Appended hello</b>.");
    });

    $("#cd").click(function(){
        $(".div").append("<li>Appended hi</li>");
    });
});
</script>

4) empty() : is use to empty div element.

eg: $(div).empty();

5) detach() : is use for detach element from main element or parent content

eg: $(p).remove() ---remove p from main div

6) scrolltop() : is use for scroll move to top from its position

<script>
$(document).ready(function(){
    $("button").click(function(){
        alert($("div").scrollTop() + " px");
    });
});
</script>

above exmple shows where is position of div & alert message


7) Delay()
is use to set delay

eg: $("#ab1").delay("5").fadeIn();
    $("#ab2").delay("fast").SlideIn();

in this way we see detail of jquery function
next time we will see more & new session ..


An Introduction to the Laravel Framework: What It Is and Why You Should Use It

  If you're a PHP developer looking for a modern, efficient, and powerful framework to build web applications, look no further than Lara...