taboubim taboubim - 3 years ago 162
HTML Question

Remove numbers on a html page using jQuery

I want to make some jQuery actions on a html page :

The page is :

my aim is to remove the numbers (represented by the class jxr_linenumber)

What I've tried is :


However google chrome said : Uncaught TypeError: $(...).text is not a function(…)!!

Even more ... when I tried this command $('a'), it returns with one element only ... however the page contains several "a" tags

Here is two screenshots to explain the issue and my goal

The screenshot of the actual page :
enter image description here

My goal = remove the numbers using jquery ... the numbers are in the red box ....
So the result should be as follow :

enter image description here

Any help ? thanks

Answer Source

The .remove() should do the trick, but my guess is that its causing some issues since jquery isnt available on the page, and injecting it after, might be why its only removing one at a time.

You could use plain javascript like this:

var elements = document.getElementsByClassName("jxr_linenumber");

while(elements.length > 0){
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download