Question

I have an automatically generated A tag in Siebel application like given below

<a href='JavaScript:SWESubmitForm(document.SWEForm2_0,s_5,"s_2_2_16_0","1-DOOYAL")'  tabindex=2997  id='s_2_2_16_0_efl''>

I need to extract the following value "1-DOOYAL" from this tag. I am not able to construct the jquery expression to do the same.

Can anybody please help??

Was it helpful?

Solution

This should do the trick:

var split = $(this).prop('href').split('","');

return split[split.length - 1].substr(-2);

OTHER TIPS

Assumes that it is always double-quoted, comes at the end, and does not have commas or parens in the value.

var href = $("#s_2_2_16_0_efl").attr("href");
var v = href.split(/[",\)]+/);
var dooyal = v[v.length-2];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top