Make first word bold of all elements using jquery
<!DOCTYPE html> <html> <head> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <meta charset="utf-8"> <title>Make first word bold of all elements</title> </head> <body> <p>PHP Exercises</p> <p>Python Exercises</p> <p>JavaScript Exercises</p> <p>jQuery Exercises</p> </body> </html>
JavaScript Code :
$('p').each(function(){ var pdata = $(this); pdata.html( pdata.text().replace(/(^\w+)/,'$1') ); });
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
JavaScript Code :