We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
function getVal(strOption) { var re_attr = /\s+(\w+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s>]+))?/g; var re = RegExp('<option((?:' + re_attr.source + ')*)\\s*>([\\s\\S]*?)<\/option>', 'i'); var a = re.exec(strOption); if (a) { var t; while (t = re_attr.exec(a[1])) { if (t[1].toLowerCase() == 'value') { var val = t[2]; if (val.length > 1) { var c1 = val.charAt(0); var c2 = val.charAt(val.length - 1); if (c1 == '"' && c2 == '"' || c1 == "'" && c2 == "'") val = val.slice(1, -1); } return val; } } return a[4]; } } var a = ["<option value='xxx' id=ppp>rrrr</option>", "<option id=ppp>rrrr</option>", "<option xxx=\"value='dd'\" id=ppp>rrrr</option>", "<option value=77d id=ppp>rrrr</option>"]; for (var i = 0; i < a.length; ++i) a[i] = getVal(a[i]); alert(a.join('\n'));
The text was updated successfully, but these errors were encountered:
function hasValueAttr(strOption) { return /^<option(?:\s+\w+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?)*\s+value[\s=]/i.test(strOption); }
Sorry, something went wrong.
#292
No branches or pull requests
The text was updated successfully, but these errors were encountered: