OneCompiler

b111

131
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Insert Text Before and After Image</title> <script src="https://code.jquery.com/jquery-3.6.4.min.js"></script> </head> <body> <img src="path/to/your/image.jpg" alt="Your Image"> <script> // Insert text before the image $('img').before('<p>This is text before the image.</p>'); // Insert text after the image $('img').after('<p>This is text after the image.</p>'); </script> </body> </html>