<div id="abc" onclick="location.href='/new-data/?asd=asd'">
</div>
我需要的输出new-data
在location.href
.
我将如何使用 jQuery 或 JavaScript 来做到这一点?
<div id="abc" onclick="location.href='/new-data/?asd=asd'">
</div>
我需要的输出new-data
在location.href
.
我将如何使用 jQuery 或 JavaScript 来做到这一点?
像这样的东西,因为 div id 是“abc”,并且 onclick 的值始终是
whatever/somedata/whatever
function GetTheContentFromOneSpecialCharacterToAnotherOne()
{
var the_full_content = document.getElementById('abc').getAttribute('onclick');
var the_parts = the_full_content.split('/');
return the_parts[1];
}