All jQuery Functions

Split function in jQuery

jQuery provides a method "split()", which splits the text. We can use any delimiter to split the text. Let me explain you with an example. Earlier I had posted about jQuery solution to replace string, substring, trim string and about all string functions, And In this post, see jQuery/JavaScript split function in action with example. […]
Read the rest of this entry »

Using trim() function in jQuery

jQuery also have trim function like javascript trim, which removes spaces from starting and from end of the string. See below code. <script type="text/javascript"> $(document).ready(function(){ var str = " I Love jQuery "; str = jQuery.trim(str); alert(str); }); </script> Output of this would be "I Love jQuery". trim function only removes spaces from starting and […]
Read the rest of this entry »

jQuery bind method Example/Demo

jQuery provides a method called bind() which binds any event types to any element. Let's say you want to bind a click event to a tag. <a>Link 1</a> Below jQuery code binds the click event to all the anchor tag of the page. $(document).ready(function() { $("a").bind('click', function() { alert('I am clicked'); }); }); So the […]
Read the rest of this entry »

Find nth:child element in its parent using jQuery

jQuery API provides a selector ":nth-child" which allows to select particular child element from its parent. For example, if you want to select 2nd li element from the ul tag. See below code. <ul> <li>jQuery</li> <li>By</li> <li>Example</li> </ul> This code will find the 1st li element and makes it forecolor to "Red". For 2nd li […]
Read the rest of this entry »

How to get HTML of any control using jQuery

In this post, we will see that how we can get the HTML part or I should say innerHTML of any control. Well, jQuery provides a function "html()" which will give the html of the control. For example, I have placed a div control on the page which has h1 and h2 tag. <div id="dvExample"> […]
Read the rest of this entry »

How to set HTML of any control using jQuery

In my previous post "How to get HTML of any control using jQuery", I had explained that how can we get the HTML of any control. In this post, I will show you how can you set HTML for any control. Well, we will use the same function html() using which we get the HTML. […]
Read the rest of this entry »