Tag Archives: javascript

jQuery Toggle Firing Twice

When trying to toggle an element on a page using jQuery, you might have the toggle happen multiple times. In other words, you click the event listening element (such as a link) and the element you want to toggle expands and collapses, then once more expands and collapses. Obviously, this is not the effect we… Read More »

JavaScript stripslashes

Sometimes you have to add slashes to javascript text. PHP has it built in, javascript does not. Here is the code to put into your javascript to get the same functionality: function addslashes(str) {      str=str.replace(/\\\\/g,’\\\\\\\\’);      str=str.replace(/\\’/g,’\\\\\\”);      str=str.replace(/\\”/g,’\\\\”‘);      str=str.replace(/\\0/g,’\\\\0’);      return str; } function stripslashes(str) {      str=str.replace(/\\\\’/g,’\\”);      str=str.replace(/\\\\”/g,'”‘);      str=str.replace(/\\\\0/g,’\\0’);… Read More »