Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

While editing a static HTML file today, I realized, that many things I did using search and replace with regular expressions, would be much easier using JavaScript (and possibly a DOM library like jQuery) and DOM manipulation.

I could, of course, load the file into a browser, type some JavaScript into the console and copy and paste the manipulated source code back to the editor. But this would be much easier if the HTML text editor supported this directly, because it could automatically load jQuery, you could store and reuse scripts, the chance that formatting gets lost is smaller, etc.

Does anyone know if something like that exists? Preferably for Windows, but suggestions for other operating systems are ok, too.

share|improve this question
    
Jsfiddle.net –  Jim G. May 28 '11 at 19:05
    
AFAIK this does not exist. I bet you could do something cool with Ace, but you'd have to implement it yourself or convince someone else to. –  Rein Henrichs May 28 '11 at 19:07
    
Thought I don't know of a product that will do that off the bat, it sounds like something you could write as an Chrome extension. Chrome has all the ingredients you need baked in - editable mode, javascript, and DOM, all fully accessible through extensions. –  Kevin Hsu May 29 '11 at 8:20

4 Answers 4

up vote 1 down vote accepted

Firefox and FireBug.

No, really. With FireBug you have:

  • Console mode, which lets you do all the usual JS business.
  • Visual CSS browsing
  • The ability to edit the page source directly via the HTML tab, and save the html file directly using Ctrl-S
  • DOM inspection

Admittedly it's not perfect (no autocomplete in html mode or anything like that), but it's pretty much a JS-based web page editor, right there in your browser!

share|improve this answer
    
Sounds like the best option right now, so I'll accept this. –  RoToRa Jun 7 '11 at 14:41

Since it doesn't look like it exists, I think that the best way to go is by writing a bookmarklet

The way i see it, you'd load the html in your browser, click on the bookmarklet and a layer would pop up with options to do the regex replace.

You could prefill it with frequently used scripts, or use a simple web call to a server (host the data in a google spreadsheet for example and query it in json) to get configuration data.

One drawback would be that you'd have to save the modified html after using the bookmarklet, and open it back in an editor after changing it in the browser. However since most editor auto-refresh files that have been modified outside of their scope, you can have the two tools opened at the same time.

You can have a look at this page where the first example is a bookmarklet that changes data in textareas

share|improve this answer

Eclipse IDE with javascript bundle:

http://eclipse.org/downloads/packages/eclipse-ide-javascript-web-developers/heliossr2

I'm using it in my everyday web developer job. It just rocks !

You have completion on html, javascript, css. You have jquery and other javascripts libraries.

An other eclipse bunlde for web developer: Aptana.

share|improve this answer
    
Sorry, but I wasn't looking for a "normal" web editor. I use Aptana. –  RoToRa Jun 7 '11 at 14:32
    
it is not mentionned on the question, and aptana can achieve this –  toutpt Jun 7 '11 at 15:49
    
Aptana can manipulate the DOM of a HTML page it's editing? How? –  RoToRa Jun 9 '11 at 10:49

notepad++

really popular and good editor. i've used it in 2 jobs so far. for html editing and it support regex and syntax highlighting. worth giving it a try. full version is free.

share|improve this answer
    
Does notepad++ provide the feature I asked about? I couldn't find anything about it on the website. –  RoToRa May 28 '11 at 9:45
3  
No, it doesn't. Thus the downvotes. –  Rein Henrichs May 28 '11 at 19:05
    
actually it DOES.. press CONTROL+H for REPLACE and you'll see a search mode allowing regular expressions. It clearly states 'Regular expression'. Please verify for yourself before down voting. –  Ross May 30 '11 at 7:23
1  
Please re-read my question. I'm not looking for regular expression search/replace. –  RoToRa Jun 7 '11 at 14:34
    
right, but i thought it helpfull to point this out to you in case it was easier.. guess not!! –  Ross Jun 16 '11 at 14:24

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.