Force links to open in a new tab, not a new window

Posted by & filed under CSS, HTML.

Yes it is possible with CSS to have links open in new tabs or new windows. I discovered this issue when testing target=”_blank” in IE9/IE10 versus Chrome. <a href=”[yourlink]” target=”_blank” style=”target-new: tab;”>GetPowers</a> Or you could put it in the header as: <html> <head> <style> a { target-new:tab; } </style> </head> <body>  There are some options… Read more »

HTML Actions vs Javascript Callbacks

Posted by & filed under HTML, Javascript.

HTML actions: The action attribute specifies where to send the form-data when a form is submitted. In HTML5, the action attribute is no longer required. We can use javascript to send data on the backend using AJAX. http://www.w3schools.com/tags/att_form_action.asp Callbacks in javascript: In general, a callback function is used once another function you have called finishes…. Read more »

Reset your form after submit using jQuery

Posted by & filed under Javascript, jQuery.

After you submit a form, you reset it with the following code: $(“form#myform”)[0].reset(); For example on my Magic8Ball website, I created a function to submit the form and reset it immediately, clearing out the input elements. var formData = $(“#form”).serializeArray(); $.ajax({ url : “speaktome.php”, type: “POST”, data : formData, success: function(result) { $(“.youranswer”).hide().html(” + result… Read more »

Change your cursor to waiting or in-progress with jQuery.

Posted by & filed under jQuery.

Found this great bit of code on SO. Basically, it changes your cursor to the progress or wait symbol whenever AJAX is started on your page. Nice for forms or submissions by the user. $(‘body’).ajaxStart(function() { $(this).css({‘cursor’:’wait’}) }).ajaxStop(function() { $(this).css({‘cursor’:’default’}) }); By the way here is a great page from w3schools on cursor types!

Dealing with apostrophes and quotation marks for forms and output with PHP

Posted by & filed under PHP.

I have run into the same annoying problem for a long time and finally found an easy solution. Whenever forms are submitted via PHP (by a user or myself) and apostrophes or quotation marks are added in forms, they are escaped using mysqli_real_escape_string and entered into the database without a hitch. However, when outputting the data… Read more »

Ultra-easy image rollover solution with jQuery (no plug-ins needed)

Posted by & filed under jQuery.

Found a fantastic image rollover solution on StackOverflow recently, with this little piece of jQuery and no other plug-ins needed your rollovers works easily and seamlessly… HTML <img data-other-src=”big-zebra.jpg” src=”small-cat.jpg”> <img data-other-src=”huge-elephant.jpg” src=”white-mouse.jpg”> <img data-other-src=”friendly-bear.jpg” src=”penguin.jpg”> Javascript $(‘img’).on(‘mouseenter mouseleave’, function() { $(this).attr({ src: $(this).attr(‘data-other-src’), ‘data-other-src’: $(this).attr(‘src’) }) });

Google Site Map Generator and Broken Link Checker

Posted by & filed under Website Development.

Found two great sites today to help create a sitemap for google and find broken links. It indexed over 3000 pages and helped me discover 2 big broken links. It even pointed me to which line in the code the broken link was found. Great websites~ http://www.web-site-map.com/ http://www.brokenlinkcheck.com/