DOM manipulation in client script
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2019 06:34 AM
I want to hide (x) icon using client script, how can I use it in getElementById
Labels:
- Labels:
-
Scripting and Coding
6 REPLIES 6

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2020 09:20 AM
Oh, and here's the client script code to hide your "x" for tags:
function onLoad() {
addAfterPageLoadedEvent(function(){
var w = false;
if (top.document.getElementById('gsft_main'))
w = top.document.getElementById('gsft_main').contentWindow.document;
if (!w) {
if (document) { w = document; }
else if (top) { w = top.document; }
}
var tmo = w.getElementById('toggleMoreOptions');
if (tmo) {
tmo.onclick = function(){
var counter = 0;
var hidden = false;
var w = false;
if (top.document.getElementById('gsft_main'))
w = top.document.getElementById('gsft_main').contentWindow.document;
if (!w) {
if (document) { w = document; }
else if (top) { w = top.document; }
}
function hideA() {
if (++counter >= 1000 || hidden) {
return;
}
setTimeout(function(){
if (w) {
var tags = w.getElementById('document_tags');
if (tags) {
var a = tags.getElementsByTagName('a');
if (!a.length)
hideA();
for (var i = 0; i < a.length; i++) {
if (a[i].classList.contains('tagit-close')) {
a[i].style.display = "none";
hidden = true;
}
}
} else {
console.warn("NO TAGS FOUND");
}
}
},1);
}
hideA();
};
}
});
}
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2022 06:51 PM
Very good, worked for me as:
var clear_secondary_address = top.document.getElementById('address_two').value = '';
👍