Delete default value of an input text on click

For future reference, I have to include the HTML5 way to do this. <input name=”Email” type=”text” id=”Email” value=”email@abc.example” placeholder=”What’s your programming question ? be specific.” /> If you have a HTML5 doctype and a HTML5-compliant browser, this will work. However, many browsers do not currently support this, so at least Internet Explorer users will not … Read more

Detect click inside/outside of element with single event handler

Here’s a one liner that doesn’t require jquery using Node.contains: // Get arbitrary element with id “my-element” var myElementToCheckIfClicksAreInsideOf = document.querySelector(‘#my-element’); // Listen for click events on body document.body.addEventListener(‘click’, function (event) { if (myElementToCheckIfClicksAreInsideOf.contains(event.target)) { console.log(‘clicked inside’); } else { console.log(‘clicked outside’); } }); If you’re wondering about the edge case of checking if the … Read more

struts2 optiontransferselect retrieve and display value from database

I think there are two things you need to know in order to solve your issue: The lifetime of a Struts action. How the optiontransferselect actually works. Lifetime of a Struts Action I start with that, because that might already solve your issue. 👉 A new instance of a Struts action is created for each … Read more

JavaScript anonymous function immediate invocation/execution (expression vs. declaration) [duplicate]

The first two cases show function expressions, and can appear anywhere an expression like (1+1 or x*f(4)) would appear. Just like how 1+1, evaluates to 2, these expressions evaluate to a corresponding function. The third case is a function declation statement, and can appear anywhere you can have other statements (like an if or while … Read more

What do the “Not optimized” warnings in the Chrome Profiler mean?

I believe that “Not optimized: optimized too many times” refers to when the chrome optimizer keeps reoptimizing a function. https://groups.google.com/forum/#!topic/v8-users/_oZ4fUSitRY If I recall correctly, there are several things that can cause this including parameters that change type, I’ll try to dig up the link. This one is somewhat cryptic and fixes will depend on your … Read more

how to monitor the network on node.js similar to chrome/firefox developer tools?

Use external HTTP Debugging tool. Your options include: node-http-proxy as seen in How do I use node.js http-proxy for logging HTTP traffic in a computer? middlefiddle written in node.js (but abandoned for 3 years now) https://github.com/mdp/middlefiddle mitmproxy – a CLI tool http://mitmproxy.org fiddler http://www.telerik.com/fiddler and many more – https://www.google.pl/search?q=HTTP+debugger You fire up one of those, … Read more