• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

javascript reg expression to replace value="...

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have this javascript where I am looping thru all the cells in a row from a table,
this row is just a copy of the previous row so i need to set all the value=something to value=""
in my test example value="231" in both the alert statements, ps need to work in IE 8 Thanks to anyone who can assist.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why in the world are you doing it through innerHTML and not DOM?



Eric
 
Sheriff
Posts: 67695
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where in your code are you getting a reference to the hidden elements? innerHTML is not going to cut it!

P.S. This is where using a library such as jQuery really pays off. Using jQuery, it's a single statement:


[Edit: Eric sneaks in yet again! ;)]
 
Rod McLure
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did not want to bore you with how I got str,
but now that I have it how to i replace value= with value=""
first alert
---------------------------
0red alert<INPUT id=field-30 value=231 type=hidden name=outcomeId>
---------------------------

second alert

0red alert<INPUT id=field-30 value=231 type=hidden name=outcomeId>
---------------------------
OK
---------------------------
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Doing it with innerHTML is still the wrong way to go on many levels.

Your debug string has no ", but your regular expression is looking for them.

Eric
 
Rod McLure
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you!,
the script was written in Firefox and the alerts have quotes in them there,
but this will not work in Explorer
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So make the quotes match zero or one time

Eric
 
reply
    Bookmark Topic Watch Topic
  • New Topic