I have an array with one element
ClickMeArray[0] = "ClickMe=a-6,a-7,a-8,a-9,"
I want variable to return elements after ClickMe=
from ClickMeArray
.
Output should be a-6,a-7,a-8,a-9,
.
ClickMeArray[0].split('ClickMe=')[1];
Try This
var val = "ClickMe=a-6,a-7,a-8,a-9,";
var myString = val.substr(val.indexOf("=") + 1);
There are many way to do this work. One way is using .replace()
. You can replace ClickMe=
with empty to getting another part of string.
var ClickMeArray = "ClickMe=a-6,a-7,a-8,a-9,"; console.log(ClickMeArray.replace('ClickMe=',''));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.