I have an html page that has a field that can be sorted. I also have created a javascript function that can sort that field in order. Let's imagine p_cSort is the 'id' name of that field.
function change_sort(neworder) {
document.sortForm.p_cSort.value = neworder;
document.sortForm.submit();
However when I have values like
12.34
12-35
12.36
12-33
and I search for them on my search page. The results returned are
12.34
12.36
12-33
12-35
How can I ignore the characters "." and "-" when sorting?
So the result I am looking for should be:
12-33
12.34
12-35
12.36
Why don't you make a custom sort function liek this:
Output:
This will also work if you have 125.5 and so on. because the
.
and the-
are both used in the compare.Example with >= 100
So input:
Will output