Posts

Showing posts with the label jQuery

Handling Multiple Scripts on Web Page

Image
Introduction This article shows how to handle multiple scripts on web page. Actually the traditional mechanism for registering even handlers through JavaScript is to assign a function to the DOM (Document Object Model) element's corresponding attribute. For example, suppose we had a function:         function doStuff() {             document.writeln( "my test line" );         } Now, we could then either assign it within our HTML markup: < body onload ="doStuff();"> </ body > Or, we could assign it from within JavaScript code:~ window.onload = doStuff(); Here is the complete design: Both approaches will cause the function to execute when the page is loaded. But the advantage of the second is that the behavior is more cleanly separated from the markup. This strategy works quite well with one function. Let's suppose we have another function:         function doStuff() {             document.writeln

Timing differences between $(document).ready() and window.onload()

Introduction In JavaScript, window.onload event fires when a document is completely downloaded to the browser. This means that every element on the page is ready to be manipulated by JavaScript, which is a boon for writing featured code without worrying about load order. On the other hand, jQuery's $(document).ready() is invoked when the DOM is completely ready for use. This also means that all elements are accessible by our scripts, but does not mean that every associated file has been downloaded. As soon as the HTML has been downloaded and parsed into a DOM tree, the code can run. Example Think of a page that presents an image gallery; such a page may have many large images on it, which we can hide, show, move, and otherwise manipulate with jQuery. If we set up our interface using the onload event, users will have to wait until each and every image is completely downloaded before they can use those features. Even worse, if behaviors are not yet attached to eleme

jQuery and CSS Selectors Part-6

Image
Introduction In this series you are going to learn all about jQuery and CSS Selectors. This post specifically shows how to style specific cell or cells. Let's first look at the problem that we will solve in this post. Problem I have following table (screenshot): And it's HTML Markup:         < table >             < tr >                 < td >                     Name                 </ td >                 < td >                     Subject/Papers                 </ td >                 < td >                     Qualifications                 </ td >                 < td >                     Join Year                 </ td >              </ tr >             < tr >                 < td >                     Mr. Ranjeet Singh                 </ td >                 < td >                     IP, MySQL, Oracle               

jQuery and CSS Selectors Part-5

Image
Introduction Download In this post you are going to learn all about jQuery and CSS Selectors, if you are still not using jQuery in your web apps, this post will motivate you. Here I am going to talk on "Custom Selectors" and filter expression, let's first look at a problem that we will solve in this article. Problem Assume I have a blog/website and I want all external URLs to open on new browser tab. For example when you click on any external URL on Facebook, it opens URL on new tag. No meaning you have mentioned "target" attribute with URL or not, I always want external URLs to open on new tab. In addition with this, I also want to add an external icon with all external URLs. How to do this? Look at the image given below: I

jQuery and CSS Selectors Part-4

Image
Introduction Download In this post you are going to learn all about jQuery and CSS Selectors, if you are still not using jQuery in your web apps, this post will motivate you. Here I am going to talk on "Custom Selectors", let's first look at a problem that we will solve in this article. Problem 1 Look at the following table structure.             < p >                 < b > Table 1 goes here. </ b >             </ p >             < table >                 < tr >                     < td > Put your texts here. </ td >                 </ tr >                 < tr >                     < td > Put your texts here. </ td >                 </ tr >                 < tr >                     < td > Put your texts here. </ td >                 </ tr >                 < tr >                     < td > Put your t

jQuery and CSS Selectors Part-3

Image
Introduction Download In this post you are going to learn all about jQuery and CSS Selectors, if you are still not using jQuery in your web apps, this post will motivate you. Here I am going to talk on "Attribute Selectors", let's first look at a problem that we will solve in this article. Problem Suppose you have a web page (or website) and you want to apply the style to all links on web page (or website) in such a way that display styles as in below image for each type of links email url, pdf file download url and word file download url, differently: I have image, you can see two different pages, an html page and an ASP.NET page. I am an ASP.NET guy so I love to use this too. Now, to create such system we need to identify the URL Attributes (which containing email or pdf or word) and add the image with url text. So, we need to take the advantage of "Attribute Selectors"

Popular posts from this blog

Migrating database from ASP.NET Identity to ASP.NET Core Identity

Customize User's Profile in ASP.NET Identity System

Lambda two tables and three tables inner join code samples