View Full Version : Replacing HTML lines using javascript

05-20-2012, 04:10 PM
Hi. I have the following line in my HTML file <table class="bz_buglist" cellspacing="0" cellpadding="4" width="100%">
And I need to use javascript to change this line to <table id="main_table" class="bz_buglist" cellspacing="0" cellpadding="4" width="100%"> . I just need to add the ID part.

How can I do this? Is there a method of replacing the line, or a way to "add attribute"? thanks!


05-20-2012, 04:39 PM

Can you provide a link to the webpage of where this code is located? This can be done through a trigger event, possibly having the code be included in the element function.

05-20-2012, 04:41 PM
Hi Taro.

Here is the webpage http://bugzilla.maptools.org/buglist.cgi?quicksearch=test

Note that this isn't my own website as I am not allowed to link my own companies bugzilla, but the idea is the exact same. I need to add id="main_table" to the tables on the page once the page is loaded. My js will run after the page is loaded and not from the web server (i'm using greasemonkey.)


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum