Software Technology Tips

JQuery helps faster page load than javascript. JQuery functions are fired when the related elements are loaded, instead of complete pageload.

This is a common practice to call a javascript function when page is loaded like

window.onload = function(){ alert("Mindfire") }
<body onload="javascript:document.getElementById('user_id').focus();">

Inside of which is the code that we want to run right when the page is loaded. Problematically, however, the Javascript code isn't run until all images are finished downloading (this includes banner ads). The reason for using window.onload in the first place is due to the fact that the HTML 'document' isn't finished loading yet, when you first try to run your code.
To circumvent both problems, jQuery has a simple statement that checks the document and waits until it's ready to be manipulated, known as the ready event


   // Your code here

I faced a browser-related issue. Suppose we have some text field with size 100 along with some text area with same no of columns. In IE the size of text field and text area are same but in mozilla textarea will display with bigger length than text fields. This disturbs our layout and we want to resize this by detecting browser.
<textarea name="mindfire" id="mindfire"  cols="47" >Mindfire Solutions</textarea>
for mozilla we have to resize it as follows:
if((navigator.appName) == 'Netscape')

 document.getElementById('mindfire').cols = 41;

But problem is that the text area will resize after complete page load so when page loading is in process user will be able to view a wrong alignment and then the right one after complete page load.
With JQuery we can do this when a specific document element is loaded. For example, when the text area is loaded the related function will be fired, as given below.

  if((navigator.appName) == 'Netscape'){

Related Tags:


Author: Subranil Dalal


Let us Connect!

Awards and Achievements

Red Herringcolor DeloitteFast50 DB ZInnov1   Nascome  DB Stpi

This site uses cookies. We respect your privacy.copyright (c) Mindfire Solutions 2007-2015. Login