<?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>Forem: Barnabas Ukagha</title>
    <description>The latest articles on Forem by Barnabas Ukagha (@mcbarna).</description>
    <link>https://forem.com/mcbarna</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%2F1229131%2F105b557e-cb83-4d14-a8f7-e6663bbfcb08.jpg</url>
      <title>Forem: Barnabas Ukagha</title>
      <link>https://forem.com/mcbarna</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/mcbarna"/>
    <language>en</language>
    <item>
      <title>Setup React With Vite on VSCode: A Step-by-Step Tutorial</title>
      <dc:creator>Barnabas Ukagha</dc:creator>
      <pubDate>Thu, 15 Feb 2024 21:41:35 +0000</pubDate>
      <link>https://forem.com/mcbarna/setup-react-with-vite-on-vscode-a-step-by-step-tutorial-591g</link>
      <guid>https://forem.com/mcbarna/setup-react-with-vite-on-vscode-a-step-by-step-tutorial-591g</guid>
      <description>&lt;p&gt;Vite is a fast and efficient build tool that delivers a high performance, flexible, and leaner development experience for modern web projects.&lt;/p&gt;

&lt;p&gt;Creating a React project can be slow and would take a couple of minutes, thereby slowing the development process. It's even worse with an older machine.&lt;/p&gt;

&lt;p&gt;Vite will make your project faster than usual. It also allows you to select the framework you want to work with.&lt;/p&gt;

&lt;p&gt;In this step-by-step tutorial, you will learn how to install React with Vite on your VSCode editor.&lt;/p&gt;

&lt;p&gt;This article is best suited for beginner front-end developers. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt; Open your VScode (Visual Studio Code) editor and open a new terminal.&lt;br&gt;
To do this, click on the three white dots at the top left area of your screen and select “Terminal” and “New Terminal”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fagos2bs2wze54vznjkon.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fagos2bs2wze54vznjkon.png"&gt;&lt;/a&gt;&lt;br&gt;
or press ```Ctrl&lt;br&gt;
&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Shift + {% raw %}&lt;code&gt;&lt;/code&gt;`` and select the folder you want your project to be in.
A new terminal will open at the bottom of your VScode editor.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt; Inside your terminal, type &lt;code&gt;npm create vite@latest&lt;/code&gt; and press enter.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnrthtregsv6odq6ofohd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnrthtregsv6odq6ofohd.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It will ask for permission to download create-vite@latest packages.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fchpcrocli5smhpf9qzjd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fchpcrocli5smhpf9qzjd.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Press &lt;code&gt;y&lt;/code&gt; and click enter.&lt;br&gt;
It will download the create-vite@latest packages; it will only take 2 or 3 seconds.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt; Vite allows you to give a name to your project. The default name is &lt;code&gt;vite-project&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In this step, you can change the name to whatever you want or leave it as the default name and press enter.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foya1b9w6hjzj03ns8gxl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foya1b9w6hjzj03ns8gxl.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I will leave mine in the default name.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt;You will see a list; use the arrow keys to move up and down the list, click enter to choose your preferred option. &lt;br&gt;
In this step, we will select React&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fikuxzxh51vq8ejqrwbw5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fikuxzxh51vq8ejqrwbw5.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, You will see four options to choose from, Navigate to and select &lt;code&gt;JavaScript&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg9clh950ze1ayq8fz65o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg9clh950ze1ayq8fz65o.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that's it; you now have your Vite project. Easy peasy, lemon squizy.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyvgoc33ng3st1bpkj8cf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyvgoc33ng3st1bpkj8cf.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But we still haven't finished yet; you have to run your project and make it live.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5:&lt;/strong&gt; Enter your Vite project with the name you saved it with in Step 3.&lt;/p&gt;

&lt;p&gt;Look at your terminal, and you will see a list of three commands. Type in the first command exactly as it is written, and press enter. Look at the image below to better understand it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0x1q16dy68mtj8tgl7bd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0x1q16dy68mtj8tgl7bd.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the image above, I typed in the first command on the list. Your command will be different if you had saved your project with a different name from mine.&lt;/p&gt;

&lt;p&gt;Type it as you see it written on your terminal and press enter to access your project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 6:&lt;/strong&gt; Next, type the second command on that list, &lt;code&gt;npm install&lt;/code&gt; and click enter.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzw5nqjr72vkt39iyqg44.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzw5nqjr72vkt39iyqg44.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That will install all the dependencies inside the Vite project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpccma8xwxndli4v1l8kd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpccma8xwxndli4v1l8kd.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It will take 3 seconds to 1 minute to complete the installation, depending on the speed of your machine and the internet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 7:&lt;/strong&gt; Type the third command on the list, &lt;code&gt;npm run dev&lt;/code&gt;. Remember to type it exactly as you see it written on the list.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frmpxc8098m3jyed4lrdu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frmpxc8098m3jyed4lrdu.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Type &lt;code&gt;npm run dev&lt;/code&gt; and press enter. It will start your Vite project.&lt;/p&gt;

&lt;p&gt;On your terminal, you will see a blue link; click on it to open your Vite project in your web browser.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fib13dmjnci8i2t1lo196.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fib13dmjnci8i2t1lo196.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Your Vite React project will look like this;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmua1nwl247jwnx27gyyn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fmua1nwl247jwnx27gyyn.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 8:&lt;/strong&gt; To access your project files, go to your VScode editor and click &lt;code&gt;Explorer&lt;/code&gt; at the top left corner of your screen.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9d67htnqjia4xnlq85yr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9d67htnqjia4xnlq85yr.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A panel will open, and you will see your project folder with all the Vite and React packages.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx6w2xj93o7eb1vyqboux.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx6w2xj93o7eb1vyqboux.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can now start working on your project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;br&gt;
See, that wasn't hard at all, and the whole process didn't take too long to complete. With time and practice, it will become faster and more intuitive.&lt;/p&gt;

&lt;p&gt;Now that you have learned to install React with Vite on your VSCode editor, I advise that you keep practicing and learn to install other libraries and frameworks. Remember, practice makes perfect.&lt;/p&gt;

&lt;p&gt;Thank You&lt;br&gt;
And&lt;br&gt;
Happy Coding.&lt;/p&gt;

</description>
      <category>vite</category>
      <category>react</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Difference between props and state in React.js</title>
      <dc:creator>Barnabas Ukagha</dc:creator>
      <pubDate>Thu, 08 Feb 2024 14:38:03 +0000</pubDate>
      <link>https://forem.com/mcbarna/difference-between-props-and-state-in-reactjs-32d8</link>
      <guid>https://forem.com/mcbarna/difference-between-props-and-state-in-reactjs-32d8</guid>
      <description>&lt;p&gt;When learning React.js, some of the first and most important concepts you will learn are props and state. One of the issues faced by beginners is not knowing the difference between props and state and when to use them.&lt;/p&gt;

&lt;p&gt;This article will teach us the difference between props and state and when to use them.&lt;/p&gt;

&lt;h1&gt;
  
  
  Difference between props and state
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Props
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Props are like arguments used to pass data from parent to child components.&lt;/li&gt;
&lt;li&gt;Props are immutable; they can't change once they've been set. &lt;/li&gt;
&lt;li&gt;Props are used in both functional and class components.&lt;/li&gt;
&lt;li&gt;You use &lt;code&gt;this.prop&lt;/code&gt; to access props in class components as well as an argument in functional components.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  State:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A state is like a component memory used to store and change data within a component.&lt;/li&gt;
&lt;li&gt;State is mutable; its data can change at any time.&lt;/li&gt;
&lt;li&gt;State is only present in class components. Functional components can only use state using React hooks.&lt;/li&gt;
&lt;li&gt;You use &lt;code&gt;this.state = {...}&lt;/code&gt; to initialize the constructor of a class component and the &lt;code&gt;useState()&lt;/code&gt; method to change it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  When to use props and state
&lt;/h1&gt;

&lt;p&gt;You use props whenever you want to parse data from parent to child components. You use state to store and change data within a component. &lt;/p&gt;

&lt;p&gt;You can use Props to parse state data from parent to child components.&lt;/p&gt;

&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;Now that you know the difference between props and state and when to use them, I urge that you practice using them on many easy projects. You might not get the hang of it at first, but with continuous practice, you will get better and master using them in no time.&lt;/p&gt;

&lt;p&gt;Also, learn and practice other React concepts like events, conditionals, and hooks to get better at React.js.&lt;br&gt;
Thank you&lt;br&gt;
And &lt;br&gt;
Happy Hacking.&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>jQuery cross-browser compatibility: fixing JavaScript cross-browser incompatibility using jQuery</title>
      <dc:creator>Barnabas Ukagha</dc:creator>
      <pubDate>Mon, 29 Jan 2024 12:21:50 +0000</pubDate>
      <link>https://forem.com/mcbarna/jquery-cross-browser-compatibility-fixing-javascript-cross-browser-incompatibility-using-jquery-3ai3</link>
      <guid>https://forem.com/mcbarna/jquery-cross-browser-compatibility-fixing-javascript-cross-browser-incompatibility-using-jquery-3ai3</guid>
      <description>&lt;p&gt;JavaScript oversaw the evolution of web development. It allowed developers to build more functional and dynamic websites. JavaScript is very popular and favored developer community that over 95% of the websites are powered by it. However, JavaScript faced the challenge of inconsistent output across different browsers until jQuery was introduced to bring cross-browser compatibility to web development.&lt;/p&gt;

&lt;p&gt;jQuery improved the use of JavaScript in web development in multiple ways, but in this article, we will be talking about how jQuery made JavaScript cross-browser compatible.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;What is cross-browser compatibility?&lt;/li&gt;
&lt;li&gt;Challenges of JavaScript cross-browser compatibility in web development

&lt;ul&gt;
&lt;li&gt;Some of the reasons for JavaScript inconsistencies are&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Introduction of jQuery and its contribution to improving cross-browser compatibility in web development.

&lt;ul&gt;
&lt;li&gt;jQuery's Universal API for Cross-Browser Compatibility&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Prerequisite
&lt;/h2&gt;

&lt;p&gt;To get the most out of this article, you should understand HTML, CSS, and JavaScript at the base level. If you are unfamiliar with these technologies, we recommend taking some time to familiarize yourself before proceeding.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is cross-browser compatibility?
&lt;/h2&gt;

&lt;p&gt;In web development, cross-browser compatibility refers to a website's or function's ability to function consistently across various browsers and devices. Cross-browser compatibility is when there are no changes in the result or behavior of a written script in different browsers.&lt;/p&gt;

&lt;p&gt;In web development, some syntaxes behave differently in different browsers or that some browsers do not support, which causes our codes to behave differently in some browsers. Achieving cross-browser compatibility gives our project a consistent output across different browsers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Challenges of JavaScript cross-browser compatibility in web development
&lt;/h2&gt;

&lt;p&gt;JavaScript is the powerhouse language of the web. It is currently being used on more than 90% of all websites. JavaScript makes building functional and dynamic websites easy, which is difficult to achieve without JavaScript. With JavaScript's success and popularity, it still faces the challenge of inconsistencies across different browsers due to how browsers process, interpret, and execute code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Some of the reasons for JavaScript inconsistencies are:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Rendering Differences:&lt;/strong&gt; Due to how different browsers render JavaScript, it may lead to unexpected behavior, styling discrepancies, and layout issues on a website.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript API Variations:&lt;/strong&gt; Some browsers may have different levels of support for JavaScript API features and implement them differently, requiring developers to write different codes for these browsers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Event Handling Discrepancies:&lt;/strong&gt; Some browsers have different ways of triggering events on JavaScript, such as clicks, hovers, or keypresses. Developers have to account for this when building websites. We have to modify event handlers for these specific websites.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Performance Variance:&lt;/strong&gt; Optimizing performance with JavaScript can be challenging because of JavaScript inconsistencies among browsers. Code that works well in one browser may perform poorly in another.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction of jQuery and its contribution to improving cross-browser compatibility in web development.
&lt;/h2&gt;

&lt;p&gt;jQuery was introduced in 2007 as a JavaScript library to streamline the use of JavaScript in web development. jQuery simplifies JavaScript Dom manipulation, animations, and Ajax, and it is cross-browser compatible.&lt;/p&gt;

&lt;p&gt;jQuery cross-browser compatibility simplifies and speeds up the production process of a website by reducing the amount of brainpower and time developers would spend thinking about writing different codes for different browsers. Without using special coding techniques to modify your code, jQuery will have consistent output across all major browsers, which makes it easier and faster to build websites.&lt;/p&gt;

&lt;p&gt;jQuery quickly became an essential tool because developers no longer had to worry about their code being compatible across browsers; they just had to write their codes, and the jQuery API would compile them across all browsers with a consistent output.&lt;/p&gt;

&lt;h3&gt;
  
  
  jQuery's Universal API for Cross-Browser Compatibility
&lt;/h3&gt;

&lt;p&gt;jQuery has a standard and simple JavaScript API that is uniform across various browsers. It takes away many of the challenges that developers face from various browsers. With this, you can rely on a uniform syntax to perform common tasks that work on all browsers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;jQuery brought cross-browser compatibility to web development. With jQuery, there is no need to write different functions for specific browsers.&lt;br&gt;
Now that you understand how easily jQuery brings cross-browser compatibility to web development, consider exploring other ways jQuery can enhance the ease of using JavaScript for web development.&lt;/p&gt;

</description>
      <category>jquery</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Enhancing jQuery DOM Manipulation: Best Practices for Optimal Performance.</title>
      <dc:creator>Barnabas Ukagha</dc:creator>
      <pubDate>Tue, 26 Dec 2023 05:25:19 +0000</pubDate>
      <link>https://forem.com/mcbarna/enhancing-jquery-dom-manipulation-best-practices-for-optimal-performance-3ai8</link>
      <guid>https://forem.com/mcbarna/enhancing-jquery-dom-manipulation-best-practices-for-optimal-performance-3ai8</guid>
      <description>&lt;p&gt;Enhancing jQuery DOM Manipulation: Best Practices for Optimal Performance.&lt;/p&gt;

&lt;p&gt;DOM (Document Object Model) manipulation is the changing of the properties( shape, size, color, position, text, sound, etc.) of an element in a web document without refreshing the page.&lt;br&gt;
Manipulating the DOM successfully is one of the most important tasks in web development. It enables developers to dynamically change the HTML elements, content, and style of a web page using JavaScript. &lt;/p&gt;

&lt;p&gt;Optimizing DOM manipulation ensures faster load-time, lower server costs, a smoother and better user experience, and improves the performance of your website. There are many methods to optimize the DOM manipulation of a web page. Some different libraries and frameworks specialize in easing the task of manipulating the DOM, but in this article, we will be looking at jQuery.&lt;/p&gt;
&lt;h2&gt;
  
  
  jQuery's Role in DOM Manipulation
&lt;/h2&gt;

&lt;p&gt;jQuery is a lightweight JavaScript library. It allows developers to write shorter codes to accomplish simple tasks that require many lines of native JavaScript code by replacing common JavaScript tasks with simple and easy-to-remember methods that can be called using a few lines of code. Among other libraries, jQuery is a popular choice due to its simplicity and extensive support for DOM manipulation, making it accessible to developers on all levels.&lt;/p&gt;

&lt;p&gt;Using native JavaScript to manipulate the DOM would require more time, syntax, lines of code, and thinking power. jQuery makes all that hard work simple by reducing the need for all that syntax, reducing the number of codes for common tasks, and offering cross-browser compatibility, which cancels the need to write different functions for specific browsers.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Best Practices For Simplified DOM Manipulation
&lt;/h2&gt;

&lt;p&gt;It has been established that jQuery makes it easier to manipulate the DOM in JavaScript, but there are still strategies and practices to follow to make the operations of your website run even smoother. Below are the best practices to follow to make it even better.&lt;/p&gt;
&lt;h3&gt;
  
  
  Minimize DOM Operations
&lt;/h3&gt;

&lt;p&gt;Reducing activities on the DOM to the minimum makes it more efficient, and efficiency is critical to a responsive website. Here is how to minimize operations.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Bundle multiple DOM changes into one method. Too many single changes to the DOM would make your web page slower. Combining style, content, and attribute changes would make a responsive website even smoother.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Utilize selectors such as IDs and classes to target element selection. By using these selectors wisely, you can precisely pick elements without traversing the entire DOM, leading to quicker operations.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Efficient jQuery Object Caching
&lt;/h3&gt;

&lt;p&gt;Object caching is the storage of references to frequently accessed DOM elements into variables for easy access. Instead of querying the DOM for the same element multiple times, you can store it in a variable using &lt;code&gt;$.cache&lt;/code&gt; and then use that variable whenever you need to access the element.&lt;/p&gt;

&lt;p&gt;Caching your DOM elements drastically improves the speed of your code execution.&lt;/p&gt;
&lt;h3&gt;
  
  
  Optimized Selector Usage
&lt;/h3&gt;

&lt;p&gt;jQuery selectors are methods used to directly select HTML elements from the DOM using attributes, values of attributes, names, classes, IDs, types, and so on to identify the specific element that is selected.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Selectors are categorized into three types&lt;/strong&gt;: basic CSS selectors, positional selectors, and custom jQuery selectors.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Basic CSS selectors&lt;/strong&gt;: use standard CSS rules, syntax, and semantics to select HTML elements. Examples are using &lt;code&gt;.&lt;/code&gt; and &lt;code&gt;*&lt;/code&gt; to call classes and IDs, respectively.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Positional selectors&lt;/strong&gt;: are methods that use the position of an element in the DOM to select it. Positional selectors also use the relationship of an element with another element in the DOM to select it, like parents, children, and siblings.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Custom JQuery selectors&lt;/strong&gt;: are methods that were created by JQuery to give developers more selector options than just CSS positional selectors. It allows developers to pick elements based on their header, checkbox, image, file, etc.&lt;/p&gt;

&lt;p&gt;To find out more about jQuery selectors, check &lt;a href="https://dzone.com/refcardz/jquery-selectors#:~:text=There%20are%20three%20categories%20of,find%20elements%20within%20the%20DOM"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Techniques for Performance Optimization
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Utilizing Event Delegation:&lt;/strong&gt; Event delegation is when the event listener of a parent element is shared by the child element. You simply attach an event listener (click, hover, keypress, etc.) to a parent element, and it will be used by the child element instead of attaching the same event listener to multiple elements.&lt;br&gt;
&lt;strong&gt;Syntax&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$(selector).delegate(childSelector,event,data,function)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To find out more about the jQuery &lt;code&gt;delegate()&lt;/code&gt; method, check &lt;a href="https://learn.jquery.com/events/event-delegation/#:~:text=Event%20delegation%20allows%20us%20to,are%20added%20in%20the%20future."&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Efficient Handling of DOM Insertions and Removals:&lt;/strong&gt;  When adding new elements to the DOM, you should use methods that are optimized for insertions into the DOM, such as &lt;code&gt;.after()&lt;/code&gt;, &lt;code&gt;.before()&lt;/code&gt;, &lt;code&gt;.insertAfter()&lt;/code&gt;, etc, and when removing elements from the DOM, use methods that are also optimized for removals, such as &lt;code&gt;.detach()&lt;/code&gt;, &lt;code&gt;.empty()&lt;/code&gt;, &lt;code&gt;.remove()&lt;/code&gt;, etc, to improve the performance of your website.&lt;/p&gt;

&lt;p&gt;Below is a table that highlights methods for insertions &lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Methods&lt;/th&gt;
&lt;th&gt;Uses&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;.append()&lt;/td&gt;
&lt;td&gt;Add content to the end of an element.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;.prepend()&lt;/td&gt;
&lt;td&gt;Add content to the beginning of an element.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;.after()&lt;/td&gt;
&lt;td&gt;Add content right after an element.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;.before()&lt;/td&gt;
&lt;td&gt;Add content just before an element.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Optimal Animation With Minimal DOM Manipulation:&lt;/strong&gt; &lt;br&gt;
jQuery has convenient animation methods, but excessive animations can negatively impact performance. Here are some ways to optimize animations for enhanced performance.&lt;/p&gt;

&lt;p&gt;Limit animations by avoiding unnecessary animations, especially indefinite loops. Decide whether an animation is necessary and how it affects the user experience.&lt;br&gt;
Use &lt;code&gt;animate()&lt;/code&gt; to pile and queue multiple animations into one batch of operations.&lt;br&gt;
Use CSS transitions more frequently. Since they are GPU-accelerated and offloaded to the browser's rendering engine, they are more efficient than jQuery animations.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Avoiding Overly Nested Method Chaining:&lt;/strong&gt; &lt;br&gt;
Method chaining is simply writing multiple jQuery functions (in the same element) in a single line. &lt;/p&gt;

&lt;p&gt;While method chaining has its merits, having too many jQuery statements in our code can cause performance degradation because it has to continuously re-access the same elements and use the same selectors, which slows down the execution of your code. &lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;To enhance DOM manipulation and optimize operations on your website, you're going to have to write shorter and cleaner codes. But first, you are going to have to write your code the way you learned how to and ensure it works. Then you can go through your code and ask yourself, “Is this short and clean enough?”. If not, then you can begin editing your code to be shorter and cleaner using the strategies and best practices listed above.&lt;/p&gt;

&lt;p&gt;Writing optimized, shorter, and cleaner code would make your code easy to read, more scalable, and easier to maintain. It would also improve the performance of your web page, which would in turn enhance the user experience.&lt;/p&gt;

</description>
      <category>jquery</category>
      <category>webdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Difference Between Vanilla JavaScript &amp; jQuery, And When Best To Use Them.</title>
      <dc:creator>Barnabas Ukagha</dc:creator>
      <pubDate>Mon, 18 Dec 2023 14:48:31 +0000</pubDate>
      <link>https://forem.com/mcbarna/difference-between-vanilla-javascript-jquery-and-when-best-to-use-them-46bn</link>
      <guid>https://forem.com/mcbarna/difference-between-vanilla-javascript-jquery-and-when-best-to-use-them-46bn</guid>
      <description>&lt;p&gt;JavaScript is a basic scripting language and the foundation of web interactivity. It has undergone a lot of changes since it was first introduced.&lt;/p&gt;

&lt;p&gt;Vanilla JavaScript simply refers to using pure, standard JavaScript without any additional libraries or frameworks like jQuery, React, or Vue.js.&lt;/p&gt;

&lt;p&gt;JQuery is a JavaScript library that simplifies the writing of JavaScript code. It has become very popular for this reason.&lt;/p&gt;

&lt;p&gt;However, with the advent of modern browsers and the development of vanilla JavaScript, things have changed. In this article, we will discuss the differences between vanilla JavaScript and jQuery, and when best to use them.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Growth And The Importance of Vanilla JavaScript To Web Development.
&lt;/h2&gt;

&lt;p&gt;In its early days, vanilla JavaScript was only being used to perform simple tasks on web pages, but grew and evolved, and became integral in the creation of dynamic and interactive web experiences.&lt;/p&gt;

&lt;p&gt;Vanilla JavaScript played a significant role in the growth of web development, due to how easily interactive and functional it made web pages. It is so favored by web developers, that over 90% of the web is powered by JavaScript.&lt;/p&gt;

&lt;p&gt;Despite its growth and favoritism by web developers, vanilla JavaScript still had its difficulties, which was why jQuery was introduced in 2006. jQuery eased the challenges faced by web developers when using vanilla JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Emergence Of jQuery.
&lt;/h2&gt;

&lt;p&gt;jQuery was presented as the solution to JavaScript's many challenges such as the inconsistencies and complexities with vanilla JavaScript when dealing with DOM(Document Object Model) manipulation and event handling across different web browsers.&lt;/p&gt;

&lt;p&gt;In a short amount of time, jQuery was recognized as a fast, small, and feature-rich JavaScript Library, that was also easy to learn and use. It made writing JavaScript with fewer codes and provided an easy-to-use API for developers. &lt;/p&gt;

&lt;h2&gt;
  
  
  Difference between vanilla JavaScript and jQuery.
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Criteria&lt;/th&gt;
&lt;th&gt;Vanilla JavaScript&lt;/th&gt;
&lt;th&gt;jQuery&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Cross-browser compatibility&lt;/td&gt;
&lt;td&gt;Vanilla JavaScript tends to be inconsistent across different browsers.&lt;/td&gt;
&lt;td&gt;By addressing inconsistencies across browsers, jQuery ensured a uniform experience.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Development time&lt;/td&gt;
&lt;td&gt;With Vanilla JavaScript, Some tasks might require more lines of code to achieve, which will take a lot of time to write.&lt;/td&gt;
&lt;td&gt;jQuery allows developers to achieve more with fewer lines of code, facilitating faster development.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Performance&lt;/td&gt;
&lt;td&gt;Vanilla JavaScript tends to execute faster since it interacts directly with the browser API, and it has no overhead library to slow it down.&lt;/td&gt;
&lt;td&gt;jQuery adds another layer of files to the JavaScript, which will in turn impact its speed and performance.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Learning progress&lt;/td&gt;
&lt;td&gt;Using Vanilla JavaScript gives one an improved understanding of the core concept of JavaScript.&lt;/td&gt;
&lt;td&gt;Using jQuery makes writing JavaScript a lot easier, which will in turn stall the learning progress of a developer.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mistakes&lt;/td&gt;
&lt;td&gt;It is easier to make mistakes or miss something while writing vanilla JavaScript code, due to how long it can be.&lt;/td&gt;
&lt;td&gt;jQuery code is mostly short, it is easy to find mistakes and correct them.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Beginner-friendly&lt;/td&gt;
&lt;td&gt;Vanilla JavaScript is less beginner-friendly and will require one to write more code than jQuery.&lt;/td&gt;
&lt;td&gt;jQuery is a lot friendlier to beginners by requiring very short and easy-to-remember syntax.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Making The Right Decision.
&lt;/h2&gt;

&lt;p&gt;One needs to know when best to use either vanilla JavaScript or jQuery.&lt;/p&gt;

&lt;h3&gt;
  
  
  Vanilla JavaScript
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;For big &amp;amp; complex projects where performance will be important.&lt;/li&gt;
&lt;li&gt;When building projects to learn to understand JavaScript better.&lt;/li&gt;
&lt;li&gt;When building a server-side application with node.js.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  jQuery
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;When you need to build a small project quickly or test ideas, jQuery would prove to be quite useful.&lt;/li&gt;
&lt;li&gt;Already existing large project that relies on jQuery, migrating out would be difficult, but it will be better to just stick with it.&lt;/li&gt;
&lt;li&gt;When building small projects for fun.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Choosing between vanilla JavaScript and jQuery is dependent on the needs of the project and the skill set and preference of the developer involved in the project.&lt;/p&gt;

&lt;p&gt;Vanilla JavaScript is more suitable for new major projects that require fast performance, while jQuery is for legacy projects that were already built with jQuery. &lt;/p&gt;

&lt;p&gt;With all that has been said, it is still best for a web developer to master both vanilla JavaScript and jQuery, and understand when best to use them, to ensure the best outcome of their project.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>jquery</category>
    </item>
    <item>
      <title>Create a Simple Random Quote Generator Using Jquery and Advice Slip Api</title>
      <dc:creator>Barnabas Ukagha</dc:creator>
      <pubDate>Fri, 08 Dec 2023 16:24:26 +0000</pubDate>
      <link>https://forem.com/mcbarna/create-a-simple-random-quote-generator-using-jquery-and-advice-slip-api-1n5j</link>
      <guid>https://forem.com/mcbarna/create-a-simple-random-quote-generator-using-jquery-and-advice-slip-api-1n5j</guid>
      <description>&lt;p&gt;The task is to create a simple random quote generator using Jquery, with the help of advice slip api. This tutorial will guide you on how to build a quote generator and how to use api’s with Jquery.&lt;br&gt;
 You only need a basic knowledge of HTML5, CSS, JavaScript, and Jquery.&lt;/p&gt;

&lt;h2&gt;
  
  
  HTML
&lt;/h2&gt;

&lt;p&gt;In this tutorial, we have created a div with class “wrapper” in our HTML file.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;

&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;”wrapper”&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;This will be a container for our main content.&lt;/p&gt;

&lt;p&gt;In the div, we have inserted four different tags.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;

     &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"wrapper"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;h5&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"header"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/h5&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;p&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"quote"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;""&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;""&lt;/span&gt; &lt;span class="na"&gt;srcset=&lt;/span&gt;&lt;span class="s"&gt;""&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"divider"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"dice-btn"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"style/images/icon-dice.svg"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"dice image"&lt;/span&gt; &lt;span class="na"&gt;srcset=&lt;/span&gt;&lt;span class="s"&gt;""&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
     &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;The class "header" will contain the quote number.&lt;/p&gt;

&lt;p&gt;The class "quote" will contain the random generated quotes.&lt;/p&gt;

&lt;p&gt;The img tag is for decoration.&lt;/p&gt;

&lt;p&gt;the class "dice-btn", will be the button with the function to generate new quotes when clicked. we chose to use this particular image because it looks cool, you can use any image of your choice or a button tag, if you want to stick to traditions.&lt;/p&gt;

&lt;h2&gt;
  
  
  CSS
&lt;/h2&gt;

&lt;p&gt;Further, we have included some CSS codes to style our project.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;

 &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;"Manrope"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-weight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;800&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;200px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;218&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;23%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;16%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;flex-direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;35%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="nc"&gt;.wrapper&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;relative&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;217&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;19%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;24%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.8em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;flex-direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;6%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;6em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="nc"&gt;.wrapper&lt;/span&gt; &lt;span class="nc"&gt;.header&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;150&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;66%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;letter-spacing&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.2em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="nc"&gt;.wrapper&lt;/span&gt; &lt;span class="nt"&gt;p&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;193&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;38%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;86%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;x-large&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;text-align&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;line-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1.5em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="nc"&gt;.wrapper&lt;/span&gt; &lt;span class="nc"&gt;.divider&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;padding-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="nc"&gt;.wrapper&lt;/span&gt; &lt;span class="nc"&gt;.dice-btn&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;-2em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;150&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;66%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;4em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;4em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1020px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;padding-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="nc"&gt;.wrapper&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;40%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="nc"&gt;.wrapper&lt;/span&gt; &lt;span class="nc"&gt;.header&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;medium&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="nc"&gt;.wrapper&lt;/span&gt; &lt;span class="nt"&gt;p&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;larger&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="nc"&gt;.wrapper&lt;/span&gt; &lt;span class="nc"&gt;.divider&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;padding-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="nc"&gt;.wrapper&lt;/span&gt; &lt;span class="nc"&gt;.dice-btn&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;pointer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;transition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0.3s&lt;/span&gt; &lt;span class="n"&gt;ease&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="nc"&gt;.wrapper&lt;/span&gt; &lt;span class="nc"&gt;.dice-btn&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt; &lt;span class="m"&gt;3px&lt;/span&gt; &lt;span class="n"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;150&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;66%&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1440px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;padding-top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="nc"&gt;.wrapper&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;margin-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;8em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="nc"&gt;.wrapper&lt;/span&gt; &lt;span class="nc"&gt;.header&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;large&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="nc"&gt;.wrapper&lt;/span&gt; &lt;span class="nt"&gt;p&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;x-large&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;We also made it responsive to mobile and desktop screen size's.&lt;/p&gt;

&lt;h2&gt;
  
  
  Jquery
&lt;/h2&gt;

&lt;p&gt;We included the Jquery codes by CDN. in-between the head tags, we created two &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tags, which specifies the src attributes for linking the Jquery file to our HTML.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;

    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"https://ajax.googleapis.com/ajax/libs/jquery/3.6.4/jquery.min.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"script.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;And then, we added the following paths in the src attributes.&lt;/p&gt;

&lt;p&gt;The CDN path in the first &lt;code&gt;&amp;lt;script&amp;gt;&lt;/code&gt; tag , will make it possible to write jquery codes in out JavaScript file.&lt;/p&gt;

&lt;p&gt;Now we move onto our script.js file, and begin to write our jquery codes to make our project functional.&lt;/p&gt;

&lt;p&gt;First we added the &lt;code&gt;ready()&lt;/code&gt; method in jquery.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

 &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;ready&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;ready()&lt;/code&gt; method is used to make a function available after the document is loaded. Whatever code one writes inside the &lt;code&gt;$(document).ready()&lt;/code&gt; method will run once the page DOM is ready to execute JavaScript code.&lt;/p&gt;

&lt;p&gt;Then we added a function called &lt;code&gt;getAdvice()&lt;/code&gt;.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

  &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;ready&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;getAdvice&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{};&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;&lt;code&gt;getAdvice&lt;/code&gt; function will be responsible for generating our random quotes using the get advice api.&lt;/p&gt;

&lt;p&gt;Then we added two lines of codes into &lt;code&gt;getAdvice&lt;/code&gt;.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

  &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;ready&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;getAdvice&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://api.adviceslip.com/advice&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;The first line of codes in &lt;code&gt;getAdvice&lt;/code&gt; function creates a variable "res", which holds the link to the get advice slip api, and will send a request using the fetch method.&lt;br&gt;
 The second line creates a variable "data", that receives the response of the advice slip api.&lt;/p&gt;

&lt;p&gt;Then we added two more lines of codes to the getAdvice function.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

 &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;ready&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;getAdvice&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://api.adviceslip.com/advice&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;.header&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;html&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`ADVICE #&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;slip&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;.quote&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;html&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`"&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;slip&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;advice&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="nf"&gt;getAdvice&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;This function sends a request to the advice slip api and appends its response to both the "header" and "quote" class in the HTML.&lt;/p&gt;

&lt;p&gt;Then we added an &lt;code&gt;onClick&lt;/code&gt; event to the dice button image (class="dice-btn") that calls up the &lt;code&gt;getAdvice()&lt;/code&gt; function whenever the button is clicked.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

 &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;ready&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;getAdvice&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://api.adviceslip.com/advice&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;.header&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;html&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`ADVICE #&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;slip&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;.quote&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;html&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`"&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;slip&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;advice&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="nf"&gt;getAdvice&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="nf"&gt;$&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;.dice-btn&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;click&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;getAdvice&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Now we have a working quote generator.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Below is the result of our code.&lt;/strong&gt; &lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkmwru9ms2bykur4a8din.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkmwru9ms2bykur4a8din.png" alt="screenshot of our finished quote generator"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can visit the live site &lt;a href="https://advice-generator-mcbarna.netlify.app/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>learning</category>
      <category>webdev</category>
      <category>jquery</category>
    </item>
    <item>
      <title>My first post</title>
      <dc:creator>Barnabas Ukagha</dc:creator>
      <pubDate>Fri, 08 Dec 2023 15:35:54 +0000</pubDate>
      <link>https://forem.com/mcbarna/my-first-post-468</link>
      <guid>https://forem.com/mcbarna/my-first-post-468</guid>
      <description>&lt;p&gt;Hello everyone, my name is Barnabas, and I'm new here. &lt;/p&gt;

&lt;p&gt;I'm really excited to make my first post on dev.to.&lt;/p&gt;

&lt;p&gt;I'm a newbie in the world of technical writing, and would be glad to make as many friends as possible in said field.&lt;/p&gt;

&lt;p&gt;Your guidance would be appreciated, thank you.&lt;/p&gt;

</description>
      <category>hello</category>
    </item>
  </channel>
</rss>
