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

  • جي كويري

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

الأجوبة

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" );
});
هل كان المحتوى مفيد؟

معلومات ذات صلة

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...