473,471 Members | 1,744 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to make a JavaScript function that can delete/modify text/tags from the HTML?

27 New Member
I need to make a script that can modify the already existing header tag. So in the <header> it says "Original Content" and I need to change it to "new content". I have to do that using the <button> tag and an event handler, but I have no idea what to use after the onclick. I also have another button that has to delete the text of the <header>. Is that a whole different story? Any answer will be appreciated.
May 13 '13 #1

✓ answered by Dormilich

e.g. textContent

3 1350
Dormilich
8,658 Recognized Expert Moderator Expert
I also have another button that has to delete the text of the <header>. Is that a whole different story?
no, the only difference is that you replace the current content with empty/no content.

what you need to look at are DOM functions (accessing and modifying HTML elements).
May 13 '13 #2
hrstissiaopai
27 New Member
I know I have to user some property of the document object, but which one?
May 13 '13 #3
Dormilich
8,658 Recognized Expert Moderator Expert
e.g. textContent
May 14 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Leila | last post by:
Hi, I am having a problem retrieving the html tags from my XML document when it's being loaded into a DOM object. For example, my xml contains the following: <my:InsideView> .. ..
2
by: Raja Kannan | last post by:
Is there a way to remove text portion from the HTML keeping the HTML Tags using the browser, say javascript RegEx or something ? I have seen lot of examples removing HTML tags to get the text...
3
by: Mike Kamermans | last post by:
How do I find out from which tag I called a javascript function at runtime? I have a stack of nested custom tags, in the following structure: <tag_1 value="someval"> <tag_2>content</tag_2>...
2
by: Got2Go | last post by:
Hello, I am trying to come up with a function that will search the source of the page for a specific string. If that string is found, then have it modify specific tags inside of a table and...
2
by: Chris | last post by:
I am new to these forums and hope I am in the right place! I am working on an ASP (3.0) page that displays hotel data from a recordset in a table. In the last column of each row, I want to...
16
by: Philippe C. Martin | last post by:
Hi, I am trying to change the data in a form field from python. The following code does not crash but has no effect as if "form" is just a copy of the original html form. Must I recreate the...
2
by: hemant | last post by:
hi all, i am working on a website using asp.net-vb.net i am using a textbox(web control) and want to run javascript function as the text in the textbox is changed. but as soon as i run the page...
1
by: lwhitb1 | last post by:
I have been trying to load a javascript function from the body onload html tag, but I only want the function to load the first time the page is loaded: I have investigated but haven't found...
1
by: tgorton | last post by:
I am having a problem running a javascript function as part of an html-el:form onsubmit. The problem seems to exists in IE6 but not in Firefox. html: <html-el:form action="${target}"...
4
by: simikc | last post by:
Hi, I am using a javascript function for hiding a particular html row while clicking the check box. Each row corresponds to different checkbox. The code I have used is: <asp:Checkbox...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.