HTML5 Quickstart Template – Mobile Viewport, CSS3, Google Font, Latest jQuery – All Ready

Posted by & filed under HTML, Javascript, jQuery, Website Development.

Whenever I want to quickly make a webpage, I don’t want to have to build the whole page everytime. Here is my starter code for an HTML5 page. The key points are : HTML5 Doctype – Ready Viewport and Mobile – Ready Title tags, Character Set, Keyword and Description Meta, Favicon, Stylesheet tags – Ready… 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 »

Preventing users from going backwards

Posted by & filed under Javascript.

We created a quiz on driverstest.info┬áthat allows people to get coins if they get the right answer. If you get enough coins you can get on the high score list. However, I found that some people were using the back button on the browser and doing the same question again and again. The better idea… Read more »