How to Use Change Attributes Properties in jQuery?

So in this blog, we’re going to learn that How to Use Change Attributes Properties in jQuery?

So let’s go ahead and do that for first in index.html, with help of style.css & main.js and define-

In this main.js To read the current value of an attribute, use attr() with only one argument: the name of the attribute you want to read. after that Retrieve the value of the href attribute of the “<a>” tag This is logged into the console. To see it, press F12 in Firefox/Chrome to open the Developer Tools and click on the Console tab.

Change Attributes Properties in jQuery

Tagged : / / / / / /

What is Event in Javascript?

What is Event

The actions to which JavaScript can respond are called Events. An Event is some notable action to which a script can respond.

  • Clicking an element
  • Submitting a form
  • Scrolling page
  • Hovering an element

Event Handler

An Event handler is JavaScript code associated with a particular part of the document and a particular event. A handler is executed if and when the given event occurs at the part of the document to which it is associated.

  • onclick
  • ondblclick
  • onchange
  • onblur

Event Binding with HTML Attribute

These bindings are element attributes, such as onclick and on change, which can be set equal to JavaScript that is to be executed when the given event occurs at that object.

Ex: – <button onclick= “alert(‘Button Clicked’);”>Click Me</button>

Event Binding with JavaScript

When we use this approach we can add or remove handlers dynamically as well as it improves the separation between the structure of the document and its logic and presentation.

Ex: –

Event Binding with JavaScript

Overwriting Event Handler

DOM Event Model

The DOM 2 Event Model specification describes a standard way to create, capture, handle and cancel event in a tree like structure such as an XHTML document’s object hierarchy.


  • Capture Phase
  • Target Phase
  • Bubbling Phase

addEventListener ( )

This method is introduced by DOM2, used to engage an event handler in a page.

Object.addEventListener(event, handler, capturePhase);


  • Object is the node to which the listener is to be bound.
  • Event is a string indicating the type of event.
  • Handler is the function that should be called when the event occurs.
  • capturePhase is a Boolean indicating whether to use Bubbling (false) or Capture (true). This is optional. If you omit there is false by default.

btn.addEventListener(“click”, show, false);

Why we should use addEventListener ( ) ?

Why we should use addEventListener ( )

  • It allows you to bind multiple handlers to an object for the same event.
  • It enables you finer-grained control of the phase when the listener is activated (Capture or Bubbling).
  • It works on any DOM element, not just HTML elements.

removeEventListener ( )

DOM Event Flow/ Event Propagation

The DOM 2 Event Model specification describes a standard way to create, capture, handle and cancel event in a tree like structure such as an XHTML document’s object hierarchy.


  • Capture Phase
  • Target Phase
  • Bubbling Phase

Event Object

DOM events pass an Event object as an argument to handlers. This object contains extra information about the event that occurred.

Ex:- addEventListener(“click”, function(e) { });

Event Methods

  • stopPropagation() –  Prevents further propagation of the current event in the capturing and bubbling phases.

Syntax:- e.stopPropagation();

  • stopImmediatePropagation() – Prevents other listeners of the same event from being called.

Syntax:- e.stopImmediatePropagation();

  • preventDefault()  – The Event interface’s preventDefault() method tells the user agent that if the event does not get explicitly handled, its default action should not be taken as it normally would be.

Syntax:- e.preventDefault();

Mouse Event

  • mousedown – It fires when mouse button is pressed down.
  • mouseup – It fires when the mouse button is released.
  • click – It fires when something is clicked. mousedown, mouseup and click events fires in sequence.
  • dblclick – It fires when something is clicked twice in rapid succession. mousedown, mouseup, click, mousedown, mouseup, click, and dblclick events fires in sequence.
  • mouseenter – It fires when a mouse starts to hover over some element. NO bubble.
  • mouseleave – It fires when a mouse exits while hovering over some element. No bubble.
  • mouseover – It fires when mouse is hovering over some element.
  • mouseout – It fires when mouse leaves from hovering over some element.
  • mousemove – It fires when the mouse moves.
  • contextmenu – It fires when mouse right button is clicked.

Focus Event

  • focus – It fires when an element gains focus, such as selecting a form field. No Bubble
  • blur – It fires when element loses focus, such as moving away from a form field. No Bubble
  • focusin – It fires just as an element is about to gain focus.
  • focusout – It fires just as an element loses focus and just before the blur event.

Key Event

  • keydown – It fires as a key is pressed down.
  • keypress – It fires after a key is pressed down (after keydown). It only works with printable characters.
  • keyup – It fires as the key is released.
Tagged : / / /

Manipulation Attributes in JavaScript


The attributes property returns a live collection of all attribute nodes registered to the specified node. It is a read-only property.


Attr Object


  • name (do not use nodeName)
  • value (do not use nodeValue or textContent or appendChild() or insertBefore( ) or removeChild( ) or replaceChild( ) these all are deprecated for attr object)


  • setAttribute( )
  • getAttribute( )
  • removeAttribute( )

setAttribute( )

This method is used to set the value of an attribute on the specified element. If the attribute already exists, the value is updated; otherwise, a new attribute is added with the specified name and value. We should not use this method to set inline style as it will overwrite other CSS properties.

Element.setAttribute(name, value);
Element.setAttribute(“style”, “css properties: value”);

Ex: –
p.setAttribute(“id”, “mydiv”);
p.setAttribute(“style”, “font-size: 80px”);

getAttribute( )

The getAttribute() returns the value of a specified attribute on the element. If the given attribute does not exist, the value returned will either be null or “ ”.

Syntax: –
var attribute = element.getAttribute(attributeName);

removeAttribute( )

This method is used to remove an attribute from the specified element.

Syntax: –

hasAttribute( )

The hasAttribute() method returns a Boolean value indicating whether the specified element has the specified attribute or not.

var result = element.hasAttribute(attr_name);

Tagged : / / / /

Top 10 Attributes of SREs (Site Reliability Engineer)

These days most of the organizations can not operate without IT.

The systems and processes they support are so critical, their infrastructure has to be reliable. Therefore, we need SRE engineers to set up a process and develop highly reliable and scalable systems. Their main objective is to make the process and system – accountable for the availability, performance, effectiveness, emergency response, and monitoring of the application.

At a higher level, we can say, the SRE eningeers serves as a bridge between development teams and operations teams of the organizations, empowering the dev team to bring new releases to the production frequently and as quickly as possible, while also ensuring an agreed-upon acceptable level of IT operations performance and error risk in line with the service level agreements (SLAs) the organization has in place with its clients or end users.

So what attributes makes you a great SRE engineer? Here we have mentioned top 10 attributes which SRE engineers use to have:-

1. They understand the fundamentals:- Great SREs use to have a good understanding of what lies below the abstractions. You can not identify and propose a solution to a deadlock if you do not understand the concurrency, or understand why a database is slowing down without understanding the data structures used and computer architecture.

2. Strong understanding of all-around engineers:- Great SREs are strong in technicals who happen to really enjoy reliability engineering and have the personality for the role.

3. Enjoy debugging:- Debugging is usually an undervalued and under-honed expertise that great SREs hold and enjoy using.

4. Good understanding of tools:- A great SRE takes pride in their toolset and knows how to use and build tools.

5. Good code readers:- Great SREs can promptly dive into and navigate an unfamiliar codebase.

6. Grasps complex machines:- SREs have to keep large systems in their head to develop good analytical skills and intuition about probable root causes of problems.

7. Bias towards many small projects:- SREs tend to prefer having many short-duration projects with occasional longer projects, more so than the average engineer.

8. More fascinated than annoyed by failures:- SREs watch things break every day, and its easier if they’re fascinated by watching things break rather than becoming overly jaded and cynical.

9. Bias towards excitement:- Great SREs tend to be a bit more adrenaline-fueled than the average engineer.

10. Team-oriented mindset:- A great SRE doesn’t have an us-vs-them mentality from the outset. (And a great dev team doesn’t, either).

Getting into site reliability engineering can be a great way to enhance your career possibilities. Good knowledge of SRE discipline, tools, best practices, and benefits can prepare you to take on more responsibilities in your organization, as well as it will make you prepare for the higher-tier positions.

DevOpsSchool offers SRE training, tailor-made SRE workshops and SRE consulting and solutions to successfully learn and implement SRE in your organization.

Tagged : / / / / / /

Html attribute

Attributes provide additional information about the contents of an element. They appear on the opening tag of the element and are made up of two parts: – a name and a value, separated by an equals sign.

The attribute name indicates what kind of extra information you are supplying about the element’s content. It should be written in lowercase.
The value is the information or setting for the attribute. It should be placed in double quotes. Different attributes can have different values.
 In this example an attribute called lang is used to indicate the language used in this element. The value of this attribute on this page specifies it is in US English.

Note: – HTML5 allows you to use uppercase attribute names and omit the quote marks, but this is not recommended.

Tagged : / / /

What is the best way to learn HTML?

HTML is an unbiased, straightforward and simple language to learn. This helps you learn how to make it easier for other languages like JavaScript. There are many ways to learn HTML, but according to your question there is only one way to learn online courses .. Try to learn from them. Make HTML content on the web more interactive. If you want to learn HTML it would be much easier if you already have basic HTML skills, which can be easily learned online.

From this course you may learn about:

  • HTML Environment
  • HTML Attributes
  • HTML Tags
  • HTML Skills

Suitable for developers, 28 lectures and through the course of 1.5 hours of content, you can establish a strong understanding of the concept behind all learn HTML skills and web development. Each section ends with a challenge, brings immediate practical use your newly learned skills.

Let’s start with the installation of best code editor on the market, this course you HTML tags, attributes, explaining how the elements and use them.

With these HTML skills you have learned, you will be hungry to learn the other web development languages that inspired you to become a successful web developer.

If you want to learn the HTML, then the entire HTML courses to develop their skills than others do.

From this course you may learn about:

  • Learn the basics of HTML5, CSS APIs
  • Code and publish free apps with cloud-based databases and storage.
  • GPS, voice or recognition and maximize hardware on your phone, including your app’s camera.
  • Create your own progressive web applications with the installed icon and offline instant access.
  • Use social networks and sharing sites to embed and share viral content.
  • Create your own projects to address while website, app.
  • Integrate your work with Instagram, Twitter, Facebook, WhatsApp, SnapChat, YouTube and Google Maps.
Tagged : / / / / / / / /

How to Check File Attributes in Perl ? Perl File Attributes explained


Checking File Attributes in Perl

I have been using perl for quite some time now. I have also been using the file handling logic in my scripts. However, what I did not know till now is that you can quickly check for certain file properties in perl. Here is an example:
my (@description,$size);
if (-e $file)
push @description, ‘binary’ if (-B _);
push @description, ‘a socket’ if (-S _);
push @description, ‘a text file’ if (-T _);
push @description, ‘a block special file’ if (-b _);
push @description, ‘a character special file’ if (-c _);
push @description, ‘a directory’ if (-d _);
push @description, ‘executable’ if (-x _);
push @description, (($size = -s _)) ? “$size bytes” : ‘empty’;
print “$file is “, join(‘, ‘,@description),”\n”;
Nice, isn’t it?
Here is the complete list of features that you can check:

Operator Description
-A Age of file (at script startup) in days since modification.
-B Is it a binary file?
-C Age of file (at script startup) in days since modification.
-M Age of file (at script startup) in days since modification.
-O Is the file owned by the real user ID?
-R Is the file readable by the real user ID or real group?
-S Is the file a socket?
-T Is it a text file?
-W Is the file writable by the real user ID or real group?
-X Is the file executable by the real user ID or real group?
-b Is it a block special file?
-c Is it a character special file?
-d Is the file a directory?
-e Does the file exist?
-f Is it a plain file?
-g Does the file have the setgid bit set?
-k Does the file have the sticky bit set?
-l Is the file a symbolic link?
-o Is the file owned by the effective user ID?
-p Is the file a named pipe?
-r Is the file readable by the effective user or group ID?
-s Returns the size of the file, zero size = empty file.
-t Is the filehandle opened by a TTY (terminal)?
-u Does the file have the setuid bit set?
-w Is the file writable by the effective user or group ID?
-x Is the file executable by the effective user or group ID?
-z Is the file size zero?
Tagged : / / / / / / / / / / / / / / /