Javascript examples for jQuery:Tag Edit
Use prepend() method to insert the text "Hello" at the beginning of the <p> element.
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("p").prepend("Hello"); });/* w ww . j av a 2 s. co m*/ </script> </head> <body> <p> World!</p> </body> </html>