I have a requirement to read the "Name" column in a SharePoint document library, tried many things but didn't really work. I am using below code to alert a lookup column and ItemID upon uploading a file in the library. Please see below screenshot for columns info on Document library.
When I checked the Internal Name of the Name column, it says: LinkFilename. Can someone help me how would I read the Name column field in the below code. THanks in advance.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { $("#ctl00_ctl41_g_dbb46bd2_e248_49a1_b1b7_932ee0cf704c_ctl00_ctl02_ctl00_toolBarTbl_RightRptControls_ctl00_ctl00_diidIOSaveItem").click(function () { var entityid = $("select[title='Entity ID']").find("option:selected").text(); alert(entityid); var itemID = getParameterByName('ID'); alert(itemID); var docname =$('LinkFilename').val(); alert(docname); }); }); function getParameterByName(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), results = regex.exec(location.search); return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } </script> 