Sometimes you have strings that must fit within a certain pixel width. This function attempts to do so efficiently. Please post your suggestions or refactorings below :)  function fitStringToSize(str,len) {     var shortStr = str;     var f = documen...
I have two tabs in my app one is a player tab and another is a coaching tab. I have a function1 in the player tab and function2 in the coaching tab.   function1  var beforeList = $('#players').val() $('#players').change(function () {...
I have been trying to learn how to add testing to existing code -- currently reading reading Working Effectively With Legacy Code.  I have been trying to apply some of the principles in JavaScript, and now I'm trying to extract an interface.  In...
I wrote this jsfiddle based largely on the example  found here. The example is over 2 years old so I was wondering if there is an easier way to check the value of a radio button than gobs of if, elseif, else statements. My values are going to be disa...
This is a somewhat noob-question for someone who had a few years of web development experience, but after not finding the answer on either Programmer Stack Exchange or Google, I have decided to ask it here.  I am using Express web framework for Node....
I am refactoring some code, and want to change an array of code/name objects to be named objects. I want to do this so I can use it for equality tests. The old way was to compare the code directly...  if(current.addressCode === "1"){ ... }...
Over a year ago, I remember watching one of DevExpress evangelists previewing or at least promoting rich Javascript refactoring (beyond just limited intellisense) within the Visual Studio shell, I recall part of CodeRush/DevExpress product line. I wa...
Background  I'm trying to refactor some long, ugly Javascript (shamefully, it's my own).  I started the project when I started learning Javascript; it was a great learning experience, but there is some total garbage in my code and I employ so...
I'm writing a JS webapp client. User can edit list/tree of text items (say, a todo list or notes). I manipulate DOM with jQuery a lot.  User can navigate the list up and down using keyboard (similar to J/K keys in GMail), and perform several othe...
I'm working on a project where we are doing a lot of custom javascript and especially jquery, on an mvc style project.  The only problem is that I keep adding more and more global functions/variables and they are piling up.  I've got a few fi...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.