Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

JavaScript querySelector - By class

<div class="box">
  <h3>Heading inside the 1st box.</h3>
  <p>This is a paragraph inside the <b>1st box</b>.</p>
</div>
<div class="box">
  <h3>Heading inside the 2nd box.</h3>
  <p>This is a paragraph inside the <b>2nd box</b>.</p>
</div>

<script>
  // selecting element by class
  let element = document.querySelector(".box");

  element.style.background = "lightgreen";
</script>
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript grpc timestamp 
Javascript :: faire un tableau en javascript 
Javascript :: how to get time zone difference date-fns 
Javascript :: display fetch response js 
Javascript :: how to access variable from another component in angular 
Javascript :: read dictionary values 
Javascript :: javascript this Inside Object Method 
Javascript :: create random password javascript 
Javascript :: simple todo list javascript 
Javascript :: how to get checkbox value in jquery 
Javascript :: FTP download local file 
Javascript :: javascript set() method 
Javascript :: vue3 header 
Javascript :: string equals javascript 
Javascript :: javasccript this.innerHTML 
Javascript :: Map put() method 
Javascript :: arcgis for javascript 
Javascript :: js insert 
Javascript :: usereduce 
Javascript :: structure data in javascript 
Javascript :: promise definition in javascript 
Javascript :: airbnb react native eslint 
Javascript :: chart js 
Javascript :: vanilla tilt js 
Javascript :: array reduce javascript 
Javascript :: react functional component 
Javascript :: component will mount hooks 
Javascript :: launch json file for rust 
Javascript :: javascript destructuring 
Javascript :: slot vuetify js 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =