Before and after with "img" and "p"...???
Hello!
If I write text before and after "img" it appears in the same line, but if I use "p" instead, I get p text, befoe text and after text in 3 lines.
How can I achiev to have before text and after text in the same line as p text?
Many thanks!!!
- <!DOCTYPE html>
- <html>
- <head>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
- <script>
- $(document).ready(function(){
- $("#btn1").click(function(){
- $("p").before("<b>Before</b>");
- });
-
- $("#btn2").click(function(){
- $("p").after("<i>After</i>");
- });
- });
- </script>
- </head>
-
- <body>
- <p> Element p</p>
- <br><br>
- <button id="btn1">Insert before</button>
- <button id="btn2">Insert after</button>
- </body>
- </html>