by Thomas Beutel

Category: javascript

I’m really liking Vue.js, especially for existing projects

Vue.js promotes itself as a progressive framework, meaning that you can start small and use as little or as much as you need. I’ve been working on Vue.js projects at both ends, some full fledged projects using vuex, components, and vue-cli, and some projects which are just a single component in an existing web page. […]

vue.js – ERROR in bundle.js from UglifyJs – SyntaxError: Unexpected token punc «(», expected punc «:»

I started playing with vue.js and used vue-cli to scaffold a new project. It all worked well until I tried npm run build. Then I got the following error: ERROR in build.js from UglifyJs SyntaxError: Unexpected token punc «(», expected punc «:» [build.js:8643,6] It took me a while to find the answer, but I found […]

WordPress Visual Composer, EventsPlus plugin and a.poplight[href^=#] syntax err

Today I came across a weird bug on a client’s wordpress site that broke Visual Composer. The Javascript console was reporting a a.poplight[href^=#] syntax err which seemed to indicate that popups were not working. Indeed, there was a section of the page with tabs that showed no content under the tabs. After a bit of googling, […]

Datatables in a Colorbox iframe with Selected Row Returned to Parent Window

I recently created a form where one of the questions was asking for a specific code (specifically, a NAICS code). The problem was that there are almost 20,000 codes to choose from, so it was not practical to use a pulldown. I hit upon the idea of using the wonderful Datatables table plugin for jQuery. […]

Find a Javascript parent node that matches a certain string

Here’s a small bit of javascript that I use in my Sencha Touch projects to find a parent with an id that matches a string. function findParentNodeRegex(regex, childObj) { var testObj = childObj; var count = 1; while(! { //console.log(‘My name is ‘ + + ‘. Let\’s try moving up one level to see […]

Detecting a click in a checkbox with jQuery

A simple script to detect when a checkbox is clicked. What you do with once you’ve detected the click is up to you. <html> <head> <script src=””></script> <script> google.load(“jquery”, “1.3.2”); google.setOnLoadCallback(function() { $(‘#agree’).click( function() { if($(this).attr(‘checked’)){ alert(‘checked’); } else{ alert(‘unchecked’); } }); }); </script> </head> <body> <p> <input id=”agree” type=”checkbox” /> I agree </p> </body></html>

Redirect from within a WordPress admin page

I was trying to perform a redirect to generate a CSV file from within a WordPress admin page using the wp_redirect( ) function, but the problem was that I would always get the dreaded “Cannot modify header information – headers already sent” message. This is because admin plugins are simply hooks that are performed within […]

Result of expression ‘document.forms[0].submit’ [[object HTMLInputElement]] is not a function.

I was trying to add a small delay into my form submission like so: <form … onsubmit=”setTimeout(‘document.forms[0].submit()’,2000);return false;”> but everytime I tried it, I got the following error: Result of expression ‘document.forms[0].submit’ [[object HTMLInputElement]] is not a function. This one had me stumped, until I realized what it was telling me… that my submit button […]