How to substring in JQuery?

Ads

 
 
 

Share on Google+Share on Google+

Java Coder
How to substring in JQuery?
1 Answer(s)      4 years and 3 months ago
Posted in : HTML

Hi,

I my JQuery application I am getting the value from server using Ajax. I have to substring the value in jQuery.

There is a variable in my program as follows:

var technologyName = "Language JavaScript";

I just want to take the value JavaScript from the above variable. Please let's know How to substring in JQuery?

Thanks

Ads
View Answers

January 21, 2013 at 11:24 AM


Hi,

There is no need to use the jQuery for getting the smaller from a big string.

JavaScript provides convenient function for this purpose.

Here is the description of the substring function of JavaScript:

string.substring(start, to);

from: value is required and it specifies the index from where program will start the extraction.

to: this is option value. If no value is specified all the string will extracted till end of the string.

Here is the complete example html and javascript code:

<html>
 <head>
  <title>JQuery Substring</title>
  <script lanuage="JavaScript">
    function test(){
        var technologyName = "Language JavaScript";
        alert("Technology:" + technologyName);
        technologyName = technologyName.substring(9);
        alert("Technology:" + technologyName);
    }
  </script>
 </head>

 <body>
  <a href="javascript:test()">Substring</a>
 </body>
</html>

Thanks


Ads









Tutorials   
Java Spring Hibernate Struts Training How to Word-wrap in an HTML table? I'm trying to pass counter data to another HTML page. How to display button as a link in vaadin? hi change navbar dropdown color in bootstrap How to remove the background color of bootstrap menu bar? How to change color of opened Bootstrap drop down toggle? Setting bootstrap container background color Help school all activities and admision process.. add one row after another date make a webpage HTMl HTMl Source code how to apply globalisation to a world wide asp.net application how to print HTML using javascript or Jquery How to recover from google panda update? How to survive google panda 4.0 update How to find if you have been hit by Panda 4.0 Design a web page using XHTML and JavaScript that does the followings: ffmpeg converting file mp4 to mov JavaScript How to Disable Catch-all Emails on CPanel z-index always on top What is Web hosting Database and HTML web development trainee Uploading files Image Gallery Image Gallery dropdown How to redirect from a HTML page? Easiest method for expiring the css and js headers HTML WITH AJAX VB 6 Read Web Page Header string palindrom using vbscript? html button How to add mod_deflate to apache without recompiling How to use place hoder in IE(version : 8) Html Software Question div align left css Fetching data from excel file on other website and display in interactive graph form where do I find the fix for tree view catalog not expanding and collapsing correctly for roseindia shopping cart 1.1 pass to next page to enter into a particular page only if the username,password and listbox value mtches hi Cricket stadium ticket booking design Need some help creating an order form.

Ads

 
Advertisement null

Ads