OnChange event using React JS for drop down

The change event is triggered on the <select> element, not the <option> element. However, that’s not the only problem. The way you defined the change function won’t cause a rerender of the component. It seems like you might not have fully grasped the concept of React yet, so maybe “Thinking in React” helps. You have to store the selected value as state and … Read more

Regex for password must contain at least eight characters, at least one number and both lower and uppercase letters and special characters

Minimum eight characters, at least one letter and one number: Minimum eight characters, at least one letter, one number and one special character: Minimum eight characters, at least one uppercase letter, one lowercase letter and one number: Minimum eight characters, at least one uppercase letter, one lowercase letter, one number and one special character: Minimum … Read more

Mongoose – What does the exec function do?

Basically when using mongoose, documents can be retrieved using helpers. Every model method that accepts query conditions can be executed by means of a callback or the exec method. callback: exec: Therefore when you don’t pass a callback you can build a query and eventually execute it. You can find additional info in the mongoose docs. UPDATE Something to note … Read more

Using Javascript in CSS

IE and Firefox both contain ways to execute JavaScript from CSS. As Paolo mentions, one way in IE is the expression technique, but there’s also the more obscure HTC behavior, in which a seperate XML that contains your script is loaded via CSS. A similar technique for Firefox exists, using XBL. These techniques don’t exectue JavaScript from CSS directly, but … Read more

Adding options to select with javascript

You could achieve this with a simple for loop: JS Fiddle demo. JS Perf comparison of both mine and Sime Vidas’ answer, run because I thought his looked a little more understandable/intuitive than mine and I wondered how that would translate into implementation. According to Chromium 14/Ubuntu 11.04 mine is somewhat faster, other browsers/platforms are likely to have differing … Read more

Javascript Uncaught TypeError: Cannot read property ‘0’ of undefined

The error is here: You are passing the first item of words, instead of the array. Instead, pass the array to the function: Problem solved! Here’s a breakdown of what the problem was: I’m guessing in your browser (chrome throws a different error), words[] == words[0], so when you call hasLetter(“a”,words[]);, you are actually calling hasLetter(“a”,words[0]);. So, in essence, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)