Showing posts with label jQuery. Show all posts
Showing posts with label jQuery. Show all posts

Sunday, June 10, 2012

jQuery: Basic Questions



1.       What is jQuery?
A
JavaScript Library
C
SQL Library
B
Java Library
D
None of the above

2.       How can elements on a web page be selected in jQuery?
A
$(“#ELEMENTID”)
C
 $(“TAG”)
B
$(“.CSSCLASSNAME”)
D
All of the above

3.       How to get the value of an element by Id?
A
$(“#ELEMENTID”).val()
C
$(“#ELEMENTID”).value()
B
$(“#ELEMENTID”).eval()
D
$(“#ELEMENTID”).find().val()

4.       How to read a file available in web server?
A
$.read(“FILENAME”)
C
$.get(“FILENAME”)
B
$.read(“FILENAME”).get()
D
None of the above

5.       What is the jQuery equivalent for window.onload() event?
A
$.document.onload()
C
$.document.ready()
B
$.document.onready()
D
None of the above

6.       How to pass parameters to an explicit function in callback event?
A
callback: function(arg1,arg2,…){}
C
None of the above
B
callback: function()
{
  functionname(arg1, arg2)
}



7.       Which option can be used to modify the display of a group of radio buttons?
A
.button()
C
.buttonset()
B
.radiobutton()
D
None of the above

8.       Can we expand more than one item description using accordion control?
A
YES
C
NO





9.       How to create an object in JavaScript?
A
var objName = new functionname();
C
var objName = new classname();
B
var new objName = functionname();
d
var objName = classname();

  10.   Complete the following code to make the autocomplete textbox functional;

<html>
<head>
<script language="javascript"
        type="text/javascript">
      var arrStates = new Array("Andhra Pradesh","Karnataka","Kerala","Tamil Nadu");
                             
      //Complete the following line
      $(document).ready(function()
                        {
                                                                    
                        });
script>
head>
<body>
       <input type="text" id="txtStates" name="txtStates" value="" />
body>
html>

Friday, June 8, 2012

jQuery <=> JavaScript

A simple comparison on jQuery notations with classic JavaScript;
 
1.       How to refer to the DOM?
jQuery:
$(document)
JavaScript:
document

2.       Page Load

jQuery:
$(document).ready(function(){ … });
JavaScript:
Window.onload = function(){  … };

3.       How to refer to an element in the page by Id?
jQuery:
$(“#ELEMENT_ID”);
JavaScript:
document.getElementById(“ELEMENT_ID“);

4.       How to refer to the elements in a page by tag name?

jQuery:
$(“input”);
JavaScript:
    document.getElementsByTagName(“input”);

Sunday, April 29, 2012

jQuery: Introduction

What is JQuery? 
To be precise "A JavaScript library". 

jQuery is a very good and simple library which can be implemented to create a rich user interface simplifying the web 2.0 development. The jQuery event model is normalized to work across multiple browsers.

What are the features of jQuery?
  • DOM element selections using the cross-browser open source selector engine Sizzle, a spin-off out of the jQuery project.
  • DOM traversal and modification (including support for CSS 1-3)
  • DOM manipulation based on CSS selectors that uses node elements name and node elements attributes (id and class) as criteria to build selectors
  • Events
  • Effects and animations
  • Ajax
  • Extensibility through plug-ins
  • Utilities - such as user agent information, feature detection
  • Compatibility methods that are natively available in modern browsers but need fallbacks for older ones - For example the inArray() and each() functions.
  • Cross-browser support
What are the available Libraries?

                jQuery UI
                jQuery AJAX

How jQuery works?
  •   Include the reference to the the jQuery.js file.
  •  Include the reference to the CSS file (if any; this comes up when we use the jQuery to design web pages.).
  • Write the simple jQuery syntaxed JavaScript code to perform appropriate operation.