I am trying to remove the character from where the alphabets are occurs.
For example
var str1 = 1001;
// if there is no alphabates, then i want to print same as it is,
//so, output: 1001
var str2 = 1001R
var str3 = 1001R1
//Expecting output = 1001 for both str2 and str3
I tried this way
var selecteVendorID = $(".chequeTable .selected .tdVendorID").text(); //1001
alert('before : ' + selecteVendorID); //before : 1001
selecteVendorID = selecteVendorID.slice(0, selecteVendorID.indexOf(selecteVendorID.match(/[a-zA-Z]/)));
alert(selecteVendorID); //100
it is removing last number.
Note
if
var str = '1001R'
that above code is working properly,