code to set a select box option value as an object

You will not be able to store objects/arrays in the value attribute, however an option would be to use data-* attributes which supports json automatically with jQuery 1.4.3+ <select> <option data-value=”{“name”:”rajiv”,”age”:”40″}”>a</option> <option data-value=”{“name”:”mithun”,”age”:”22″}”>f</option> </select> And using .change() $(“select”).change(function(){ alert($(this).find(“:selected”).data(“value”).age); }); Example on jsfiddle

Excel to JSON javascript code?

NOTE: Not 100% Cross Browser Check browser compatibility @ http://caniuse.com/#search=FileReader as you will see people have had issues with the not so common browsers, But this could come down to the version of the browser.. I always recommend using something like caniuse to see what generation of browser is supported… This is only a working … Read more

How to escape HTML

I’m very surprised no one answered this. You can just use the browser it self to do the escaping for you. No regex is better or safer than letting the browser do what it does best, handle HTML. function escapeHTML(str){ var p = document.createElement(“p”); p.appendChild(document.createTextNode(str)); return p.innerHTML; } or a short alternative using the Option() … Read more

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