.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
abhays
satyapriyanayak
SP
Ashutosh Jha
Mahesh


Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Post New Question Subscribe to Interview Questions
 
Quick Links For Interview Questions Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  OOPs  JQuery  JavaScript/VBScript
BiztalkPatten/Practices.IISWCFWPFWWF
NetworkingAptitudeOthers  All    
 

Interview Questions And Answers

What are the disadvantages of jQuery

Author: abhays          Posted Date: August 23, 2014    Category: JQuery     Points: 40

Functionality maybe limited
While JQuery has an impressive library in terms of quantity, depending on how much customization you require on your website, functionality maybe limited thus using raw javascript maybe inevitable in some cases.

JQuery javascript file required
The JQuery javascript file is required to run JQuery commands, while the size of this file is relatively small (25-100KB depending on server), it is still a strain on the client computer and maybe your web server as well if you intend to host the JQuery script on your own web server.

Explain different type of useful selectors in jQuery.

Author: abhays          Posted Date: August 15, 2014    Category: JQuery     Points: 40

Below is the list of different types of useful selectors in jQuery

$('*'): This selector selects all elements in the document.

$("p > *"): This selector selects all elements that are children of a paragraph element.

$("#specialID"): This selector function gets the element with id="specialID".

$(".specialClass"): This selector gets all the elements that have the class of specialClass.

$("li:not(.myclass)"): Selects all elements matched by <li> that do not have class="myclass".

$("a#specialID.specialClass"): This selector matches links with an id of specialID and a class of specialClass.

$("p a.specialClass"): This selector matches links with a class of specialClass declared within <p> elements.

$("ul li:first"): This selector gets only the first <li> element of the <ul>.

$("#container p"): Selects all elements matched by <p> that are descendants of an element that has an id of container.

$("li > ul"): Selects all elements matched by <ul> that are children of an element matched by <li>

$("strong + em"): Selects all elements matched by <em> that immediately follow a sibling element matched by <strong>.

$("p ~ ul"): Selects all elements matched by <ul> that follow a sibling element matched by <p>.

$("code, em, strong"): Selects all elements matched by <code> or <em> or <strong>.

$("p strong, .myclass"): Selects all elements matched by <strong> that are descendants of an element matched by <p> as well as all elements that have a class of myclass.

$(":empty"): Selects all elements that have no children.

$("p:empty"): Selects all elements matched by <p> that have no children.

$("div[p]"): Selects all elements matched by <div> that contain an element matched by <p>.

$("p[.myclass]"): Selects all elements matched by <p> that contain an element with a class of myclass.

$("a[@rel]"): Selects all elements matched by <a> that have a rel attribute.

$("input[@name=myname]"): Selects all elements matched by <input> that have a name value exactly equal to myname.

$("input[@name^=myname]"): Selects all elements matched by <input> that have a name value beginning with myname.

$("a[@rel$=self]"): Selects all elements matched by <a> that have rel attribute value ending with self

$("a[@href*=domain.com]"): Selects all elements matched by <a> that have an href value containing domain.com.

$("li:even"): Selects all elements matched by <li> that have an even index value.

$("tr:odd"): Selects all elements matched by <tr> that have an odd index value.

$("li:first"): Selects the first <li> element.

$("li:last"): Selects the last <li> element.

$("li:visible"): Selects all elements matched by <li> that are visible.

$("li:hidden"): Selects all elements matched by <li> that are hidden.

$(":radio"): Selects all radio buttons in the form.

$(":checked"): Selects all checked boxex in the form.

$(":input"): Selects only form elements (input, select, textarea, button).

$(":text"): Selects only text elements (input[type=text]).

$("li:eq(2)"): Selects the third <li> element

$("li:eq(4)"): Selects the fifth <li> element

$("li:lt(2)"): Selects all elements matched by <li> element before the third one; in other words, the first two <li> elements.

$("p:lt(3)"): selects all elements matched by <p> elements before the fourth one; in other words the first three <p> elements.

$("li:gt(1)"): Selects all elements matched by <li> after the second one.

$("p:gt(2)"): Selects all elements matched by <p> after the third one.

$("div/p"): Selects all elements matched by <p> that are children of an element matched by <div>.

$("div//code"): Selects all elements matched by <code>that are descendants of an element matched by <div>.

$("//p//a"): Selects all elements matched by <a> that are descendants of an element matched by <p>

$("li:first-child"): Selects all elements matched by <li> that are the first child of their parent.

$("li:last-child"): Selects all elements matched by <li> that are the last child of their parent.

$(":parent"): Selects all elements that are the parent of another element, including text.

$("li:contains(second)"): Selects all elements matched by <li> that contain the text second.

You can use all the above selectors with any HTML/XML element in generic way. For example if selector $("li:first") works for <li> element then $("p:first") would also work for <p> element.

How do you select element by ID in jQuery?

Author: abhays          Posted Date: August 15, 2014    Category: JQuery     Points: 40

To select element use ID selector. We need to prefix the id with "#" (hash symbol). For example, to select element with ID "txtName", then syntax would be,
$('#txtName')

What are selectors in jQuery and how many types of selectors are there?

Author: abhays          Posted Date: August 15, 2014    Category: JQuery     Points: 40

To work with an element on the web page, first we need to find them.

To find the html element in jQuery we use selectors. There are many types of selectors but basic selectors are:

Name: Selects all elements which match with the given element Name.

#ID: Selects a single element which matches with the given ID

.Class: Selects all elements which match with the given Class.

Universal (*): Selects all elements available in a DOM.

Multiple Elements E, F, G: Selects the combined results of all the specified selectors E, F or G.

Attribute Selector: Select elements based on its attribute value.

How to load jQuery locally when CDN fails?

Author: abhays          Posted Date: August 15, 2014    Category: JQuery     Points: 40

It is a good approach to always use CDN but sometimes what if the CDN is down (rare possibility though) but you never know in this world as anything can happen.

Below given jQuery code checks whether jQuery is loaded from Google CDN or not, if not then it references the jQuery.js file from your folder.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script type="text/javascript"> if (typeof jQuery == 'undefined') { document.write(unescape("%3Cscript src='Scripts/jquery.1.9.1.min.js' type='text/javascript'%3E%3C/script%3E")); } </script>
It first loads the jQuery from Google CDN and then check the jQuery object. If jQuery is not loaded successfully then it will references the jQuery.js file from hard drive location. In this example, the jQuery.js is loaded from Scripts folder.

How to load jQuery from CDN?

Author: abhays          Posted Date: August 15, 2014    Category: JQuery     Points: 40

Below is the code to load jQuery from all Three CDNs.

1.Code to load jQuery Framework from Google CDN
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"> </script>


2.Code to load jQuery Framework from Microsoft CDN
<script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery/jquery-1.9.1.min.js"> </script>


3.Code to load jQuery Framework from jQuery Site(EdgeCast CDN)
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.min.js"> </script>

Which are the popular jQuery CDN? and what is the advantage of using CDN?

Author: abhays          Posted Date: August 15, 2014    Category: JQuery     Points: 40

There are 3 popular jQuery CDNs.
1. Google.
2. Microsoft
3. jQuery.

Advantage of using CDN.

It reduces the load from your server.
It saves bandwidth. jQuery framework will load faster from these CDN.
The most important benefit is it will be cached, if the user has visited any site which is using jQuery framework from any of these CDN

What is a CDN (content delivery network)?

Author: abhays          Posted Date: August 15, 2014    Category: JQuery     Points: 40

A content delivery network or content distribution network (CDN) is a large distributed system of servers deployed in multiple data centers across the Internet. The goal of a CDN is to serve content to end-users with high availability and high performance.

How to Restore a site backup using Powershell command in SharePoint Server?

Author: abhays          Posted Date: August 15, 2014    Category: SharePoint     Points: 40

Use below Powershell script command
Restore-SPSite -Identity http://myserver -Path "c:\backup\file.bak"

Why there are two different version of jQuery library?

Author: abhays          Posted Date: August 15, 2014    Category: JQuery     Points: 40

jQuery library comes in two different versions.
1.Production
2.Deployment
The production version is quite useful at development time as jQuery is open source and if you want to change something then you can make those changes in production version.

But the deployment version is minified version or compressed version so it is impossible to make changes in it. Because it is compressed, so its size is very less than the production version which affects the page load time.

« Previous12345678910….456457Next »


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend