All Questions

1468
votes
19answers
592632 views

Event binding on dynamically created elements?

I have a bit of code where I am looping through all the select boxes on a page and binding a .hover event to them to do a bit of twiddling with their width on mouse on/off. This happens on page ready...
1021
votes
14answers
650334 views

window.onload vs $(document).ready()

What are the differences between JavaScript's window.onload and jQuery's $(document).ready() method?
78
votes
15answers
18377 views

So what if custom HTML attributes aren't valid XHTML?

I know that is the reason some people don't approve of them, but does it really matter? I think that the power that they provide, in interacting with JavaScript and storing and sending information fr...
51
votes
1answers
14008 views

What is Unobtrusive Javascript in layman terms?

What is Unobtrusive Javascript in layman terms? An example would be nice to aid my understanding.
43
votes
4answers
58011 views

How to check browser for touchstart support using JS/jQuery?

In an attempt to follow best practices, we're trying to use the proper JavaScript/jQuery events according to what device you are using. For example, we're building a mobile site that has an tag that ...
14
votes
7answers
10860 views

Why inline JavaScript is bad?

It is always recommended to avoid inline Javascript codes by putting all codes in a JS file, which is included in all pages. I wonder, if this does not cause performance problem in heavy pages. For e...
27
votes
2answers
19803 views

Using Google Analytics asynchronous code from external JS file

I'm trying to add the asynchronous version of the Google Analytics tracking code to a website. I'd like to keep the JavaScript in a separate file, and call it from there. Here's what I've currently ...
21
votes
6answers
20611 views

MVC unobtrusive validation on checkbox not working

I'm trying to implement the code as mentioned in this post. In other words I'm trying to implement unobtrusive validation on a terms and conditions checkbox. If the user hasn't selected the checkbox...
69
votes
4answers
28036 views

Javascript: Module Pattern vs Constructor/Prototype pattern?

I would like to know if the module pattern or Constructor/protoType pattern is more applicable to my work. Basically I am using unobtrusive javascript -- the HTML document has a reference to the .js ...
24
votes
5answers
7880 views

Help, "this" is confusing me in JavaScript

Working with the JavaScript one of the confusing thing is when using this var x = { ele : 'test', init : function(){ alert(this.ele); } } However when dealing with multiple object and ...

Previous Next