function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Srikanth Challa 3Srikanth Challa 3 

How to trim the first two characters using Javascript?

 Hi Guys,
Can any 1 suggest me how to trim the 1st three characters in Javascript
<td style="font-size: 11px;text-align: center;font-family: Arial, Helvetica, sans-serif;">WO-123456</td>

I want it to be displayed as '123456'

 
Best Answer chosen by Srikanth Challa 3
Srikanth Challa 3Srikanth Challa 3
Thank you for your Answers. I used the following code and it worked
<td style="font-size: 11px;text-align: center;font-family: Arial, Helvetica, sans-serif;">
<apex:outputText value="{!RIGHT('WO-123456',6)}"></apex:outputText>
</td>

All Answers

Grant Novey 3Grant Novey 3
You can use a slice string method as documented here: http://www.w3schools.com/js/js_string_methods.asp
Vivek DeshmaneVivek Deshmane
Hi Srikanth,
Please try below code and let me know.
var str = "WO-123456";
var res = str.substring(3);

Best Regards,
-Vivek
Srikanth Challa 3Srikanth Challa 3
Thank you for your Answers. I used the following code and it worked
<td style="font-size: 11px;text-align: center;font-family: Arial, Helvetica, sans-serif;">
<apex:outputText value="{!RIGHT('WO-123456',6)}"></apex:outputText>
</td>
This was selected as the best answer