Javascript examples for jQuery:String
Use javascript substring to specify character length
<html> <head> <script src="https://code.jquery.com/jquery-1.9.1.min.js"></script> </head> <body> <script> $(document).ready(/*w w w .j a va 2s. c o m*/ function (){ var text = $("#entry-title").text(); var x= $("#entry-title").text(text.substring(0,10)); } ); </script> <h1 id="entry-title">This is a sample blog title</h1> </body> </html>