Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

214
Views
coverting hover jquery code into javascript

I need help converting a Jquery code into a javascript code where it changes the border radius of a div when hovering over it.

HTML
      <!DOCTYPE html>
    <html>
    <head>
        <link rel="stylesheet" href="SampleQ3.css" />
    </head>
    <body>
        <div>
            <h4>Pasta</h4>
        </div>
        <script src="SampleJavaScript.js"></script>
    </body>
    </html>
   


JS
    $(document).ready(function () {
        $("div").hover(function () {
            $(this).css("border-radius", "0%");
    
        }, function () {
            $(this).css("border-radius", "200px 200px 200px 200px");
        });
    });
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can do all of that only using css, but I will provide both solution js and css.

javascript code:

let divs = document.getElementsByTagName("div");
for(div of divs) {
   div.addEventListener("mouseenter", function( event ) {
       event.target.style.borderRadius = 0%;
   }, false);

   div.addEventListener("mouseover", function( event ) {
       event.target.style.borderRadius = '200px';
   }, false);

}

To do the same with css you can add a class to make it easer to target.

// css 
<style>
.div-round {
    border-radius: 200px;
}

.div-round:hover {
  border-radius: 0%;
}

</style>

//add class to div
<div class='div-round'>...</div>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!