I'm trying to extract the string between two different parts of a string, but I have encountered a problem. This is the string I'm wokring with:
onclick="functionName(1816, 1718, 0);"
The part of the string that I'm trying to extract is "1718", ie the second parameter of the function. I have tried doing this like so:
$(this).attr('onclick').substring($(this).attr('onclick').lastIndexOf(", ") + 1, $(this).attr('onclick').lastIndexOf(", "));
This gets the onclick value and should extract what's between ", " and ", " but it's not doing so, it outputs ",".
Thanks for any input on this!