|
|
#1 |
|
How do I update text in Javascript?
Hi everyone. When I get rid of a object on my webpage with ".removeChild", I am not sure how to update the other text on the page. I should point out that I am creating the objects with the ".createElement" command.
Example of what I mean: You get ten buttons to delete. They all show you which number button they are. If you delete one button, then the rest update their "button number" so there isn't a "gap in the numbering". If anyone could help, it would be great! |
|
|
|
0
|
|
|
#2 |
|
Well your example isn't very specific. There can be a number of ways to do things depending on the exact HTML you're working with. One thing to look at though is .innerHTML. For instance, if your object was a p tag you could do:
PHP Code:
|
|
|
|
0
|
|
|
#3 | |
|
Sorry about that.
I am rather new to Javascript, so I don't really know how to describe everything yet.Quote:
Step 1: Creates several "DIV" elements with the command: ".createElement" Step 2: Sets the text inside the "DIV" tag using ".innerHTML" (different for each element" Step 3: Shows the user the text with a delete button [What I want to do] Step 4: User deletes the text and then the other "DIV" tags adjust the change (the ones above goes down by 1 ex. [Testing 31] to [Testing 30]) I hope that's a better explanation.
Last edited by pierce111; Sep 5, 2008 at 09:06 PM. |
||
|
|
0
|
|
|
#4 |
|
Yes, that explains it better. It sounds like you already have the code for removing the code so I'll just show you some renumbering code that you hopefully can apply to what you have.
HTML [HTML]<div id="divs"> <div>1 <input type="button" value="delete" onclick="RenumberDivs()" /></div> <div>2 <input type="button" value="delete" onclick="RenumberDivs()" /></div> <div>10 <input type="button" value="delete" onclick="RenumberDivs()" /></div> </div>[/HTML] JavaScript PHP Code:
Hope this helps. |
|
|
|
0
|
|
|
#5 |
|
Thanks for your help.
I had to edit it a little to do what I needed it to do, but now it works great!
|
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| thread | Thread Starter | Forum | Replies | Last Post |
| How do I align text in Pages? | applefan289 | Mac Applications and Mac App Store | 4 | Feb 20, 2013 03:01 PM |
| How do you add text/themes in iMovie for Iphone? | Khurram | iPhone | 10 | Jun 25, 2010 08:22 AM |
| how do i make text smaller in safari by default? | aleni | Mac Basics and Help | 2 | Oct 10, 2009 06:08 AM |
| How do you put text on pictures in iMovie? | PikiSkymin | Mac Applications and Mac App Store | 0 | Jul 1, 2009 04:23 AM |
| how do you make text fadein in idvd ? | dave12345 | Digital Video | 6 | Dec 19, 2008 08:44 PM |
All times are GMT -5. The time now is 11:35 PM.







I am rather new to Javascript, so I don't really know how to describe everything yet.
Linear Mode

