Web Dev Hack

Okay, so I'm a junior web developer and the company I work for are trying to develop a pretty useful little hack/application. All it will simply do is close all tage that are open, I think I my try to re-write it, but I'm not sure what would be the best approach, could you guys give me any suggestions?

I say re-write it because a previous developer that worked here had implemented such a tool, but he left and I think that he took that code with him.

Do you guys know how you could do this?

I'm sure that someone out there has done something like this before?...

I would've thought that it would be best to write it in something like Java/C++/Python, run the web code through the compiler and then put it online? .... I'm not 100% sure though.... I know there are applications that do this kinda thing, but I don't think that the company want's to pay for any software if possible. Again, it's a simple idea, useful to say the least, but how to implement it to just save you some time, that's all I'm trying to do...

No point reinventing the wheel.

Use Tidy

1 Like

If there's already an application that can do this, like you said, no point in re-doing it... But if it works well, then that's just great.

@thirdmortal, @Randomio, @JoxWar, @aghost7... Guys I've already posted this response on another thread I've made, but I thought I'd post it here too anyway:


This is a totally unrelated topic, but I've ran into a silly bug, I'm rusty with javascript right now, I used to be okay for a beginner, but I've lost that level of skill already.

Anyway, I've written some code, it works on JSFiddle, but when I try to run it on my website, it doesn't work, any idea why?

So here's the basic HTML:

<div id="results">
    <p>Product 1 : £300.00</p>
    <p>Product 2 : £35.99</p>
    <p>Product 3 : £56.98</p>
</div>

Here's the simple loop that I'm trying to run:

var arr =  document.getElementById('results').getElementsByTagName("*");
var total = 0;

for(var i =0, len = arr.length; i<len; i++){
    var str = arr[i].innerHTML;
    var n = str.match(/\£(\d+(\.\d{1,2}))/);
    console.log(n[1]);
    total += parseFloat(n[1]);
}

console.log("Total: " + total);

Like I said, it works on JSFiddle, but when I run it live, nope... Good thing I'm just messing around with some code right now... When I run it live, n = null... Any idea what I'm doing wrong? ...

I guess there's no need for the str value too, but I just have it there because I find that it makes the code a little more readable.

Link to the JSFiddle page: http://jsfiddle.net/ftfjyop1/3/

Looks fine to me.
What local environment are you using?

I was just using Chrome, not sure if the version is that relevant? .. But either way, I'm trying to get more stuff done with jQuery now, it's just easier and nicer.... Plus it tends to work better with all the different browsers as far as I'm aware.