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
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