<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Victoria igbobi</title>
    <description>The latest articles on DEV Community by Victoria igbobi (@victoriaigbobi65).</description>
    <link>https://dev.to/victoriaigbobi65</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F894324%2Faf71801d-fd16-4d3c-adbd-55115a3ea0c5.jpeg</url>
      <title>DEV Community: Victoria igbobi</title>
      <link>https://dev.to/victoriaigbobi65</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/victoriaigbobi65"/>
    <language>en</language>
    <item>
      <title>Manipulating / Accessing HTML element using JavaScript pt 1</title>
      <dc:creator>Victoria igbobi</dc:creator>
      <pubDate>Wed, 27 Jul 2022 13:20:50 +0000</pubDate>
      <link>https://dev.to/victoriaigbobi65/manipulating-accessing-html-element-using-javascript-pt-1-3ong</link>
      <guid>https://dev.to/victoriaigbobi65/manipulating-accessing-html-element-using-javascript-pt-1-3ong</guid>
      <description>&lt;p&gt;In plain English, DOM provides a way to manipulate or access HTML elements using JavaScript.&lt;/p&gt;

&lt;p&gt;Say you want to get the value of an input field or a HTML element into your JavaScript function or code, DOM makes that possible.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;It's also possible to get the value of a HTML element and access it using CSS but this article doesn't cover that&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  METHODS FOR GETTING HTML ELEMENT
&lt;/h2&gt;

&lt;p&gt;So I'd list out the methods before explaining their syntax&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;getElementByTagName()&lt;/li&gt;
&lt;li&gt;getElmentByClassName()&lt;/li&gt;
&lt;li&gt;getElementById()&lt;/li&gt;
&lt;li&gt;query selector()&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;getElementByTagName()&lt;/strong&gt;: Just as the name implies, this methods takes a HTML tag name and returns an &lt;em&gt;array&lt;/em&gt; of the HTML element with that tag.&lt;br&gt;
We can then loop through the array to get individual element like we'd loop through every other array.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Basic syntax&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//returns an array of all HTML element with the p tag
const elements = document.getElementByTagName('p') 

// Looping through the array of elements 
for (let i=0; i&amp;lt;elements.length; i++){

    //Getting each html element in the array
    Console.log(elements[i])
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;getElementByClassName()&lt;/strong&gt;: This method takes a class name and returns an array of the HTML elements with that class.&lt;br&gt;
We can loop through the array as we would an array.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Basic syntax&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//returns an array of all HTML element with the title class
const elements = document.getElementByClassName('title') 

// Looping through the array of elements 
for (let i=0; i&amp;lt;elements.length; i++){

    //Getting each html element in the array
    Console.log(elements[i])
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;getElementById()&lt;/strong&gt;: This method takes an id name and returns a single HTML elements with that id.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Basic syntax&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
const elements = document.getElementById('demo') 
Console.log(elements)

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;querySelector()&lt;/strong&gt;: This method takes either an id name or class name or tag name and returns a single HTML elements with that id, class or tag.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Basic syntax&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
// select the first available h1 element
let firstTitle = document.querySelector('h1') 

// select id with first-title
let firstTitle = document.querySelector('#first-title') 

// select the first available element with class title
let firstTitle = document.querySelector('.title') 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thanks for the read ❤️&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Object Oriented Programming (OOP)</title>
      <dc:creator>Victoria igbobi</dc:creator>
      <pubDate>Fri, 22 Jul 2022 20:21:42 +0000</pubDate>
      <link>https://dev.to/victoriaigbobi65/object-oriented-programming-oop-3og4</link>
      <guid>https://dev.to/victoriaigbobi65/object-oriented-programming-oop-3og4</guid>
      <description>&lt;p&gt;I know you are wondering what OOP is right??.&lt;/p&gt;

&lt;p&gt;The key notion of OOP is an object, an object consists of two things: data and methods(functions) that work with the data.&lt;/p&gt;

&lt;h2&gt;
  
  
  class
&lt;/h2&gt;

&lt;p&gt;A class is a template for objects. It contains the code for all the objects method.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Basic example of class&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class className {
    constructor (name) {
        this.name = name
      }
    method (){
        function body
     }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A class must contain;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;class&lt;/em&gt; Keyword&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;className&lt;/em&gt;, It should be nouns because classes represent concrete objects. e.g Investment.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Most classes have a method called &lt;em&gt;constructor&lt;/em&gt;. The constructor is usually used to set up the class variables.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The class method&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There we have the basics of OOP.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
