Hide an element with jQuery whilst scrolling

Note: This article has been marked for a quality review and will soon be updated. Today I came across an interesting problem that no amount of Google searches could solve. So I had to knuckle down and come up with a solution – and surprisingly it was much more simple that it had first appeared.… Continue reading Hide an element with jQuery whilst scrolling

Force JS replace to work on all occurrences of needle

When manipulating strings in JavaScript a useful method to know about is the replace() method. It take 2 parameters – the needle and the haystack. So if you wanted to replace ‘cat’ with ‘dog’ it might look something like this: var myString = “The cat jumped over the fence”; var myNewString = myString.replace(“cat”,”dog”); document.write(myNewString); Great it worked.… Continue reading Force JS replace to work on all occurrences of needle