|
Either " or ' can be used - in JavaScript they are identical. The only time it makes a difference is if the string contains quotes - then you'd use whichever results in you having the fewest quotes in the string needing to be escaped.
Apart from the typo in your second question where you have G where you should have .g - if there is only the one reference to the field I'd use the single statement. The first version is the more useful one once you have more than one reference to document.getElementById('inputbox') since using the separate variable means that dot only needs to be evaluated once - plus the following code is shorter.
|