Q:

Using jQuery find all textareas, and makes a border. Then adds all paragraphs to the jQuery object to set their borders red

0

Using jQuery find all textareas, and makes a border. Then adds all paragraphs to the jQuery object to set their borders red

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

HTML Code :

<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-git.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Using jQuery find all textareas and makes a border. Now adds all paragraphs to the jQuery object and makes a border.</title>
</head>
<body>
<textarea>jQuery</textarea>
<textarea>JavaScript</textarea>
<p>jQuery</p>
<p>JavaScript</p>
<button id="button1">Click to check the effect</button>
</body>
</html>

CSS Code:

button {
    display: block;
    margin: 20px 0 0 0;
    }
textarea {
    width: 200px;
    height: 60px;
    margin: 10px;
    float: left;
    font-size: 18px;
  }
  p {
    clear: left;
    font-weight: bold;
    font-size: 18px;
    color: green;
    margin: 5px 10px 0 10px;
    padding: 2px;
  }

JavaScript Code :

$('#button1').click(function(){ 
$( "textarea" ).css( "border", "2px solid red" ).add( "p" )
  .css( "border", "2px solid red" );
});

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now