Skip to content
the poor coder

hello world jquery

Poor Man
Published
Reading time
1 min read
On this page

Hello world jquery#

If you're a web developer, you must have heard about the jQuery library. It's a popular JavaScript library that simplifies HTML document traversing, event handling, animating, and AJAX interactions for rapid web development.

What is "Hello World" in jQuery?#

"Hello World" in jQuery is a simple program that displays "Hello World" on the web page using jQuery. Here is how you can write the "Hello World" program in jQuery:

JavaScript

      $(document).ready(function() {
        $("body").append("Hello World");
      });
    

The above code adds an h1 heading with the text "Hello World" inside the body element of the web page. The $() function is used to select HTML elements, and the .append() method is used to add new content to the selected elements. The code is wrapped inside the $(document).ready() method to ensure that it runs only when the document is fully loaded.

Another way to write "Hello World" in jQuery:#

Here is another way to write the "Hello World" program in jQuery:

JavaScript

      $(function() {
        $("

This code also adds an h1 heading with the text "Hello World" inside the body element of the web page. The $() function is a shorthand notation for $(document).ready(), and the .text() method is used to set the text content of the new element. The .appendTo() method is used to append the new element to the selected elements.

So, these are the two ways to write "Hello World" in jQuery. You can choose any of these methods, depending on your preference and coding style.

Keep going

2023

how to sort an array

How to Sort an Array If you have an array and you want to order its elements in a specific way, you need to use a sorting algorithm. There are several sorting algorithms available, but two of the most commonly used are…

javascript2 min read
2023

jquery mobile or desktop

jQuery Mobile or Desktop? As a web developer, I have had some experience with both jQuery Mobile and jQuery Desktop. Both frameworks have their pros and cons, and which one to use really depends on the specific project…

javascript1 min read
2023

node.js folder structure

Node.js Folder Structure If you are new to Node.js, it can be daunting to create a folder structure that will work for your project. The structure you choose will depend on the size and complexity of your project. Here…

javascript1 min read
ESC