Programmers, developers and internet users have always been confused between Java and JavaScript. Many people still thinks that JavaScript is part of Java platform, which is not true. In truth, JavaScript has nothing to do with Java, only common thing between them is word "Java", much like in Car and Carpet, or Grape and Grapefruit. JavaScript is a client side scripting language for HTML, developed by Netscape, Inc, while Java is a programming language, developed by Sun Microsystems. James Gosling is Inventor of Java, popularly known as father of Java. While in today's world calling JavaScript just a client side scripting language would not be good, as its now been used in servers also using node.js and people are doing object oriented development in JavaScript, but that was what it was originally developed. There are several difference between Java and JavaScript, from how they are written, compiled and executed. Even capability of Java and JavaScript vary significantly. Java is full feature Object oriented programming language, used in almost everywhere, starting from programming credit card to server side coding. Android uses Java as programming language for creating Android apps, Swing is a Java API used to create desktop applications and Java EE is a Java platform for developing web and enterprise applications. On the other hand JavaScript is primarily used to bring interactivity into web pages, though there are other alternatives like Flash, JavaScript is the most popular one and regaining lots of ground lost earlier with introduction of powerful and easy to use libraries like jQuery and jQuery UI. You can use JavaScript to validate user input, create animation and cool effects in HTML page and can do lot of interactive stuff e.g. reacting on button click, mouse movement, image click etc. In this article, I will share some key differences between Java and JavaScript, mostly from a programmers perspective.
Top 20 jQuery Interview Questions and Answers
Without a doubt, jQuery has given a much needed boost to JavaScript, a language so useful but equally underrated at times. Before jQuery comes into picture, we used to write lengthy JavaScript code not just for bigger but even for smaller functionality. Those code were at times both difficult to read and maintain. Having written JavaScript before using this excellent library, I realized true power of jQuery, just after using it for a month. Given it's huge popularity, jQuery interview questions are increasingly asked in any web developer interview, not just beginners but also experienced developers, including HTML and JavaScript. Since jQuery is relatively new, most interview questions are asked from core jQuery library including selectors, DOM manipulation and jQuery basics.
Labels:
HTML and JavaScript
,
interview questions
,
JQuery
jQuery Class and ID Selector Example Tutorial
One of the best thing of jQuery is there selectors, which gives jQuery enormous power to find and select DOM elements so easily. If you are coming from JavaScript background then you might love those classical methods e.g. getElementById() and getElementByName(), which has served very well in old days of JavaScript coding, but once you start using jQuery selector, which is quite similar to CSS selector, I am sure you will be forget them. Searching and selecting DOM elements using jQuery selectors are natural, intuitive and super easy. In this jQuery tutorial, you will learn how to find elements using jQuery class and ID selector. Just remember that, ID selector always return one element, because browser doesn't allow duplicate ID and two HTML element can't have same ID, which means if you just need to find just one element in DOM tree than best selector is ID selector. ID selector is also fastest way to find elements in jQuery. Now, if you need to select multiple elements, you can use class selector. jQuery class selector allows you to find all elements, which has same CSS class. Since multiple elements can use same CSS class, jQuery class selector can return multiple elements. Also remember that, jQuery ID selector uses #id to find element, while jQuery class selector uses .class for selecting elements. In this jQuery beginners tutorial, I will show you how to select element using jQuery ID and class selector and later modify them.
Labels:
How to examples
,
HTML and JavaScript
,
JQuery
,
programming
How to Create Tabs UI using HTML, CSS, jQuery, JSP and JavaScript
JSP is still a popular technology for developing view part of Struts and Spring based Java application, but unfortunately it doesn't have rich UI support available in GWT, or any other library. On other day, we had a requirement to display HTML tables inside tabs, basically we had two tables of different data set and we need to display them in their own tabs. User can navigate from one tab to other, and CSS should take care of which tab is currently selected, by highlighting active tab. Like many Java developers, our hands on HTML, CSS and JavaScript is little bit tight than a web guy, and since our application is not using any UI framework, we had to rely on JSP to do this job. Since display tag is my favourite, I had no problem to dealing with tabular data, our only concern was how we will develop tabbed UI by just using HTML, CSS, JavaScript or may be jQuery. It looks everything is possible with these technology, we eventually able to develop our JSP page, which can show data in tabs. So if you need to create tabs in JSP page, you can use this code sample, all you need to ensure is you have required libraries e.g. display tag library, JSTL core tag library and jQuery. I will explain you step by step how to create tabs in html or jsp page.
Labels:
HTML and JavaScript
,
java
,
JQuery
,
JSP and Servlet
How to redirect a page or URL using JavaScript and JQuery
Redirecting a web page means, taking user to new location. Many website use redirect for many different reasons, e.g. Some website redirect user from old domain to new domain, some redirect from one page to another e.g. a more relevant page. If you are Java programmer, and worked previously with Servlet and JSP, then you might be familiar with SendRedirect and Forward methods, which are used to redirect user in web applications. Actually there are two kinds of redirect, Server side redirect and client side redirect. In Server side redirect, server initiate redirection, while in client side redirect, client code does the redirection. Redirecting a web page using JavaScript and JQuery is a client side redirection. Well, HTTP redirection is a big topic and different people do it differently. e.g. bloggers mostly used platform like WordPress, Blogger feature to redirect a page, though this might be restricted to same domain. In this JavaScript and jQuery tutorial, we will learn a new JQuery tip to redirect a page.
Labels:
HTML and JavaScript
,
JQuery
How to use multiple JQuery UI Date Picker or Datepicker in HTML or JSP page
We often needs to use multiple JQuery date picker in one HTML or JSP page,
classical example is online flight booking for return trips, where you need to
pick departure date and arrival date from two separate datepickers. While
designing HTML forms either statically or dynamically using JSP, you may want to
associate date picker with multiple input text field, paragraph or any other
HTML elements. By using JQuery UI and some help from CSS ID and class
selector, we can easily use multiple datepicker in one HTML page. All you need
to do is, declare a CSS class say .datepicker and apply
that class to all HTML elements which needs date picker, for example we have
associated date picker with 4 input text fields, which has .datepicker class. By
using a class, it becomes extremely easy to select all
those element using JQuery
class selector, and once you got all those element, you can just call datepicker() methos.
This method does all the hard-work and associate a date picker object with
selected items, that's it. Now you are ready to use multiple date picker in
your HTML or JSP page, let's see the complete code. By the way if you are just
starting with jQuery than I highly recommend Head First Query, it’s easy to read and
contain some non trivial example to learn jQuery quickly.
Labels:
HTML and JavaScript
,
JQuery
,
jQuery UI
,
programming
3 CDN URL to load jQuery into Web Page from Google, Microsoft
jQuery is one of the most popular and powerful JavaScript library, but in
order to use it, you need to load into your webpage using standard HTML <script> tag. Based
on whether your webpage is public accessible or for a organization, you can
either choose to load jQuery library from local file system, bundled inside your
web application or you can directly download using one of the content delivery
network (CDN) e.g. Google or Microsoft CDN. Choosing
CDN to download jQuery can offer a performance benefit because there
servers are spread across the globe. This also offer an advantage that if
visitor of your site has already downloaded a copy of jQuery from the
same CDN, then it won't have to be re-downloaded. By the way if you want to bundle jQuery into
your web application or want to load it from local file system, you can always
download latest version of jQuery from jQuery site at http://jquery.com.
Installing jQuery required this library to be placed inside your web
application and using the HTML <script> tag to include it into
your pages e.g. <script type="text/JavaScript"
src="scripts/jquery-1.10.2.js"></script>. jQuery
site offers compressed and uncompressed copies of jQuery files, uncompressed
file is good for development and debugging, but can slow down page loading if
used in production. Compressed file saves bandwidth and improves performance in
production. In this article, I
am sharing couple of CDN URLs from where you can directly load jQuery files into
your web page, this includes popular Google CDN, jQuery CDN and Microsoft CDN.
Labels:
HTML and JavaScript
,
JQuery
,
programming
Location:
United States
Subscribe to:
Posts
(
Atom
)