jquery exercises

jQuery: Insert a jQuery object after all paragraphs

jQuery Fundamental - I : Exercise-10

Using jQuery insert a jQuery object (similar to an Array of DOM Elements) after all paragraphs.

Sample solution :

HTML Code :

<!DOCTYPE html>
<script src="https://code.jquery.com/jquery-git.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Using jQuery insert a DOM element after all paragraphs.</title>
<style type="text/css">
  button {
  display: block;
  margin: 20px 0 0 0;
  }   </style>
<span>with solution</span>
<p>jQuery Exercises</p>
<button id="button1">Click to see the effect</button>

JavaScript Code :

$( "p" ).after( $( "span" ) );

Used Methods :

  • .after() : Insert content, specified by the parameter, after each element in the set of matched elements.

See the Pen jquery-fundamental-exercise-10 by w3resource (@w3resource) on CodePen.

Contribute your code and comments through Disqus.

ankara escort
kızılay escort