138
rated 0 times
[
141]
[
3]
/ answers: 1 / hits: 21748
/ 7 Years ago, thu, june 1, 2017, 12:00:00
I am working on a function which looks through a list of table values on the page and if the column title contains any part of the output
, it will convert the value accordingly.
function createLink(field, val) {
var output = {
'ntid': 'https://internal/profile/' + val,
'email': 'mailTo:' + val
};
var i, key, keys = Object.keys(output);
for ( i = 0; i < keys.length; ++i ) {
key = keys[i];
if ((field.toLowerCase()).includes(key)) {
return '<a href='+output[key]+' target=_blank>'+val+'</a>';
}
}
return val;
}
The issue I am running into is that IE is throwing an error on the .includes()
line stating that Object doesn't support property or method 'includes'.
I had a bit of trouble getting it to work as is but didn't realize includes()
must be something that not all browsers support.
Is there something else I can use in place of this that will allow for cross browser support ?
More From » javascript