Virtual Surreality

It's too real to be true

Browsing Posts tagged javascript

Came across this twice in the past two weeks. How NOT to do it: $(‘form :submit’).click(function() { $(this).attr(“disabled”, true); $(this).val(“wait…”); $(this).addClass(“disabled”); }); Doing it the above way, the click event will indeed fire, but on some browsers the submit event will not. The event to bind to is submission of a form, not clicking of [...]

Prepare Java strings for JavaScript evaluation, similar to SQL prepared statements. Saves you from quote escape nightmares!

When you have more backslashes than words in the strings you are constructing, perhaps it’s time to look at another way of handling special characters like quotes.