I have a json string that is a regular raw string and job a javascript object. How do i load this json into a javascript object so that I can use it normally?  var jsonStr = ""{""property1"": ""test"", ""property2"": ""something else"" }"";alert(loadedJson.property1); The example above is a basic idea of what I am trying to…
Calculating the length of a string is a very simple thing to do in most programming languages. It is an action that you will find yourself needing to perform very often. Be it for validation, reporting or comparisons, knowing how to find how many characters a piece of text has using code is incredibly useful.…
I am using JsPDF and I want to add an image to a pdf document. I have followed the examples from the code and it seems fairly simple to make it work. For some reason I am getting a console error when I try to perform this. The error reads "addImage is not a function".…
I have a canvas window and there is an element that i want to programmatically add to it. If a user adds a background image, i want to be able to toggle a semi transparent overlay that makes the text above stand out more clearer and is the main focus instead of it being the…
I have an array of items where they are key value pairs. I want to select one at random, but I do not know how to get the key for a random item in the array. I can use [crayon-5e4f89ec0866d238653250-i/] to generate a random index but how do i get the key? Here is the…
If you are using the sortable feature of the jQuery library, you will likely want a way to get the order of the elements. You can do this very easily using one of the built in events. The following code will obtain the element order for a sortable div and output the data to the…
This tutorial will show you how to take┬áthe media manager from Wordpress and use it on an external page with a stock version of TinyMCE. I saw some posts about this and people were calling the Wordpress editor to achieve this. Its an option, but it is not what this guide is for. If you…
There are lots of ways to validate a link click. If you are programming a website that will be used by a large number of clients, then you will need to use a more secure method of validating user clicks. This is a very simple way of implementing this. If you are looking to prevent…
So you have hit the issue where you have a responsive website and everything looks great, but then you notice that embeded videos do not correctly fit within your responsive design. Fear not this can be quickly fixed by adding a div around all of your embeded videos and a little bit of css to…