Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa HTML How to substring in JQuery?
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Java Coder
How to substring in JQuery?
1 Answer(s)      a year and 8 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


Advertisement
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



Related Tutorials/Questions & Answers:
Advertisements
Advertisements
 

 

 

DMCA.com