{"id":1970,"date":"2013-01-13T02:26:51","date_gmt":"2013-01-13T02:26:51","guid":{"rendered":"https:\/\/theextremewebdesigns.com\/blog\/?p=1970"},"modified":"2013-01-13T02:26:51","modified_gmt":"2013-01-13T02:26:51","slug":"javascript-substring-jquery-substring-how-to-use-substring-in-javascript-jquery","status":"publish","type":"post","link":"https:\/\/theextremewebdesigns.com\/blog\/javascript-substring-jquery-substring-how-to-use-substring-in-javascript-jquery\/","title":{"rendered":"JavaScript Substring \/ jQuery Substring Examples"},"content":{"rendered":"<p>In JavaScript, the\u00a0substring() method extracts the characters from a string, between two specified indices, and returns the new sub string. So if you want to find out <em><strong>how to use Substring in JavaScript \/ jQuery<\/strong><\/em>, then this article is for you as the solution is the same. \u00a0Examples follow. So read on to find out more.<!--more--><\/p>\n<h2>How to use Substring in JavaScript \/ jQuery<\/h2>\n<div class=\"make_demo\">\r\n\r\n\t<form action=\"https:\/\/theextremewebdesigns.com\/blog\/wp-content\/themes\/ewd_blog_2017\/try_demo.php?post_id=1970\" method=\"post\" name=\"form1\" target=\"_blank\" id=\"form1\">\r\n\r\n\r\n\t<input type=\"hidden\" name=\"shortcode_content\" id=\"shortcode_content\" value=\"\" \/>\r\n\r\n        <div class=\"try_demo_btn_container\">\r\n\r\n\r\n            <button type=\"submit\" name=\"sbt_make_demo\" id=\"sbt_make_demo\" class=\"btn-primary btn-try-demo\">\r\n                Try Demo\r\n            <\/button>\r\n\r\n\r\n        <\/div><!-- .try_demo_btn_container -->\r\n\r\n    <\/form>\r\n    <\/div>\r\n    \n<p>So as the definition says, substring() method extracts the characters from a string by\u00a0extracting the characters in a string between &#8220;from&#8221; and &#8220;to&#8221;. This will exclude \u00a0the &#8220;to&#8221; itself.<\/p>\n<p><strong>Example: Use Substring in jQuery\/JavaScript<\/strong><\/p>\n<pre class=\"lang:xhtml decode:true crayon-selected\" title=\"JavaScript Substring \/ jQuery Substring | How to use Substring in JavaScript \/ jQuery\">&lt;html&gt;\n&lt;head&gt;\n&lt;title&gt;Examples to use JavaScript Substring \/ jQuery Substring&lt;\/title&gt;\n&lt;script type=\"text\/javascript\" src=\"js\/jquery-1.8.2.min.js\"&gt;&lt;\/script&gt;\n&lt;\/head&gt;\n\n&lt;body&gt;\n\n&lt;script&gt;\n\nvar str=\"This is some custom text\";\ndocument.write(str.substring(6)); \/\/O\/P: s some custom text\ndocument.write(\"&lt;br&gt;\");\n\ndocument.write(str.substring(4,1)); \/\/O\/P: his\ndocument.write(\"&lt;br&gt;\");\n\ndocument.write(str.substring(4,4)); \/\/O\/P: \ndocument.write(\"&lt;br&gt;\");\n\ndocument.write(str.substring(4,10)); \/\/O\/P: is so\ndocument.write(\"&lt;br&gt;\");\n\ndocument.write(str.substring(1,10)); \/\/O\/P: his is so\ndocument.write(\"&lt;br&gt;\");\n\ndocument.write(str.substring(1,20)); \/\/O\/P: his is some custom \ndocument.write(\"&lt;br&gt;\");\n\n&lt;\/script&gt;\n\n&lt;\/body&gt;\n&lt;\/html&gt;<\/pre>\n<div class=\"make_demo\">\r\n\r\n\t<form action=\"https:\/\/theextremewebdesigns.com\/blog\/wp-content\/themes\/ewd_blog_2017\/try_demo.php?post_id=1970\" method=\"post\" name=\"form1\" target=\"_blank\" id=\"form1\">\r\n\r\n\r\n\t<input type=\"hidden\" name=\"shortcode_content\" id=\"shortcode_content\" value=\"\" \/>\r\n\r\n        <div class=\"try_demo_btn_container\">\r\n\r\n\r\n            <button type=\"submit\" name=\"sbt_make_demo\" id=\"sbt_make_demo\" class=\"btn-primary btn-try-demo\">\r\n                Try Demo\r\n            <\/button>\r\n\r\n\r\n        <\/div><!-- .try_demo_btn_container -->\r\n\r\n    <\/form>\r\n    <\/div>\r\n    \n<p><strong>\u00a0That&#8217;s it!<\/strong><\/p>\n<p>Do you know of any other ways to <strong>use substring using jQuery \/ JavaScript<\/strong>? Feel free to suggest by commenting below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In JavaScript, the\u00a0substring() method extracts the characters from a string, between two specified indices, and returns the new sub string. So if you want to find out how to use Substring in JavaScript \/ jQuery, then this article is for you as the solution is the same. \u00a0Examples follow. So read on to find out [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":352,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[17,20,13],"tags":[35,42],"class_list":["post-1970","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript-tips-and-tricks","category-jquery-tips-and-tricks","category-tips-and-tricks","tag-javascript-tips","tag-jquery-demos-2"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/paBnQX-vM","jetpack_sharing_enabled":true,"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/1970","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/comments?post=1970"}],"version-history":[{"count":0,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/1970\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/media?parent=1970"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/categories?post=1970"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/tags?post=1970"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}