Javascript substring function is not working while replace() function is working

1 view
Skip to first unread message

Lei

unread,
Apr 8, 2013, 1:01:15 PM4/8/13
to programmin...@googlegroups.com
 
  <script language="javascript" type="text/javascript">
     $(document).ready(function () {
        var row= $("#testing1").text().substring(2);

        alert(row);
     });

 </script>

the above code isn't working while the following one is good:

 <script language="javascript" type="text/javascript">
     $(document).ready(function () {
        var row= $("#testing1").text().replace("MCV:",'');
        alert(row);
     });
 </script>
Reply all
Reply to author
Forward
0 new messages