If you're a new user of AppGini, feel free to ask general usage questions, or look for answers here.
-
dlee
- Veteran Member
- Posts: 168
- Joined: 2020-04-14 00:21
- Location: South Carolina, USA
-
Contact:
Post
by dlee » 2025-01-25 05:12
Below is a screen capture of my app and the red box if the area I wish to change the text for programmatically. I have tried every piece of JQuery code I can find regarding this and no luck.
Hope you guys can help!
TD
Here is the page source for this area in question:
Code: Select all
<th class="inspections-fld_10" ><a href="inspections_view.php?SortDirection=asc&SortField=23" onClick="document.forms[0].SelectedID.value = ''; [attachment=0]jquery question.jpg[/attachment]document.forms[0].NoDV.value=1; document.forms[0].SortDirection.value='asc'; document.forms[0].SortField.value = '23'; document.forms[0].submit(); return false;" class="TableHeader">fld_10</a></th>
-
Attachments
-

- jquery question.jpg (43.86 KiB) Viewed 8886 times
-
jsetzer
- AppGini Super Hero

- Posts: 1944
- Joined: 2018-07-06 06:03
- Location: Kiel, Germany
-
Contact:
Post
by jsetzer » 2025-01-25 07:39
How to change the text of an <a> tag using JQuery
How to change the link-text of a table column header in AppGini table view
Code
Code: Select all
// file: hooks/TABLENAME-tv.js
// change TABLENAME, COLUMNNAME, NEW_TEXT accordingly
const TABLENAME = 'partners';
const COLUMNNAME = 'label'
let NEW_TEXT = 'This is my new column header';
// do not change below
jQuery(()=>{
jQuery(`table[data-tablename="${TABLENAME}"] > thead > tr > th.${TABLENAME}-${COLUMNNAME} > a:eq(0)`).text(NEW_TEXT)
});
Result

- chrome_ow1Lu7eZtf.png (16.92 KiB) Viewed 8880 times
Tip
You can wrap the code in a global function for example in
hooks/header-extras.php
, then call it from whereever you need, for example
relabelTableViewHeader('mytable', 'column1', 'New Text');
Hope this helps.
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readability
AppGini 25.10 + all AppGini Helper tools
-
dlee
- Veteran Member
- Posts: 168
- Joined: 2020-04-14 00:21
- Location: South Carolina, USA
-
Contact:
Post
by dlee » 2025-01-25 22:11
Thank you Jan !!! I will try this and report back
Thanks again my friend,
TD
-
dlee
- Veteran Member
- Posts: 168
- Joined: 2020-04-14 00:21
- Location: South Carolina, USA
-
Contact:
Post
by dlee » 2025-01-25 22:23
Jan your code works PERFECTLY !
Thanks,
TD