DEV Community

hartsean
hartsean

Posted on

2 2

jQuery Inheritance

Since the arrival of jQuery in 2005, client side web applications have grown substantially more dedicated to taking advantage of the newly popularized paradigm wherein javascript based interactions with the user trigger the modification of data presented on the screen.

Today, 75% of websites on the internet are using jQuery and practically all of the most popular websites in the world are heavily reliant on Javascript to perform their functions. Inheritance has been a concept so infused with classical object oriented programming that it doesn't at first glance appear to go hand in hand purely functional javascript and the realities of client side architecture. But, Inheritance is by nature a proven characteristic of data models that are widely used and distributed to perform required tasks more efficiently and sustainably in a given environment or across networks.

Here are some example of how jQuery uses inheritance to expand its usefulness as client side manipulator of data.

$(document).ready(function(){

function Character(name, job) {
this.name = name;
this.job = job;
}

Character.prototype.sayHey = function () {
return this.name + " says hello";
};

var sean = new Character("sean", false);
sean.sayHey();

$(".test").append("

Hello World!")
$(".tClass").css("color", "green");

$("input").focus(function(){
$(this).css("background-color", "cornflower-blue");
});

});

Speedy emails, satisfied customers

Postmark Image

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay