Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82033

How to remove Search label around Search Input.

$
0
0

there are no id's in the labels that wrap the Search input box making them difficult to target and remove.

the specific html is as follows:

<label>Search:<input type="search" class="" placeholder="Search Valley Members..." aria-controls="VOTERdirectory"></label>

I want to remove the label tags or leave them but remove the word Search:

I've attempted to target these labels and remove them like so:

    var $label = document.getElementsByTagName("INPUT")[0].closest("label");
    $label.replaceWith(document.getElementsByTagName("INPUT")[0]);

Although this works, it doesn't work in all browsers.

I can't stand hacking core files as this makes maintenance difficult.

Any suggestions on how to remove this would be greatly appreciated.

If I might make a suggestion for future releases:

have unique id's for all elements, and don't wrap elements that don't need to be wrapped.

e.g. change:

<label>Search:<input type="search"></label>

to

<label id="label_001">Search:</label><input type="search">

so that once they are identified they can be targeted and removed without removing the inner elements.

maybe I'm missing the forest for the trees.

Any suggestions?


Viewing all articles
Browse latest Browse all 82033

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>