Let us consider my URL as : http://test/assignment/reports/55
And below is the div structure:
<ul class="custom-list">
<li value="55">testT</li>
<li value="58">testt</li>
<li value="60">123333333333</li>
</ul>
By using the argument -> 55 i need to alert the name in the browser using jquery.
For example when i load the above url:
I need to alert the value as testT and class name as “custom-list”.
How can i do this using jquery?
Use a RegExp to get last digits of your URL (
\d+$). If the element exists, alert the text content of the element.