Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>jQuery Remove first Character from String</title> <script src="https://code.jquery.com/jquery-3.5.1.min.js"></script> <script> $(document).ready(function(){ $("a").click(function(){ var fid = $(this).attr("href"); var itemId = fid.substring(1, fid.length); alert("The ID of the linked image is - " + itemId); }); }); </script> </head> <body> <a href="#balloons">Show Balloons</a> <br> <img src="/examples/images/balloons.jpg" style="margin-top: 1000px" alt="Hot Air Balloons" id="balloons"> </body> </html>