A Scala.js tutorial: “Hello, world” with an HTML button click

Table of Contents1 - 1. Create a new HTML page2 - 2. Make updates to use jQuery3 - 3. The new Scala code4 - 4. Setting the main class5 - 5. Running this example6 - Discussion7 - Summary

In my first “Hello, world” Scala.js tutorial I showed how to get started with Scala.js, including some necessary setup/configuration work. That tutorial ended by showing how to get the string “Hello, world” displayed in a browser.

In this tutorial I’ll take this a little further and show how to create an HTML button you can click that results in the string “Hello, world” being displayed in a JavaScript alert window. When the button is clicked, the alert window will be displayed by your Scala/Scala.js code.

AJAX autocomplete with jQuery, PHP, and JSON

While adding some AJAX autocomplete functionality to a new web application, I created a simple jQuery autocomplete example, using a PHP server-side script, and JSON to communicate the data from the server to the client. After creating that simple example, I thought I'd share all that code in a "jQuery AJAX autocomplete" tutorial here.

Before we get started, I'm going to assume you're familiar with basic HTML, CSS, and JavaScript programming fundamentals. It will also help if you've had a little exposure to jQuery, though that isn't entirely necessary.

Drupal form default input focus

Drupal form FAQ: How do I get default input focus on a Drupal form field (presumably a form textfield)?

There may be a better way to do this, but here's what I just did to get default input focus on a series of Drupal form 'add' and 'edit' pages. I just included the following Drupal form suffix definition on any form where I wanted to control the default input focus:

jQuery - Create a textarea, insert text into a textarea

jQuery FAQ: How do you create a textarea using jQuery? Also, how do I insert content (text or HTML) into a textarea with jQuery?

I don't know if this will make any sense without showing my HTML, but I just used the following jQuery code to (a) get contents from a specific div tag, (b) add a textarea just before that div, (c) put the HTML contents into the new textarea, then (d) remove the original div. So, in essence, I created a new textarea with jQuery and inserted HTML into that textarea, but I got the HTML from my original div.

Win a free copy of jQuery in Action

Note: This contest has expired, but if you join our mailing list, you'll automatically be eligible to win future prizes.


Founded in 1998, devdaily.com has over 2,000 online tutorials, and receives millions of page views every year. In 2011 we'll be giving away more prizes than ever before. This month we're giving away a copy of an extremely popular book, jQuery in Action.

A Drupal jQuery Mobile theme - screenshots

Summary: A Drupal jQuery mobile tutorial/demo.

As I wrote yesterday, I just started working on a mobile Drupal app (web app) that uses jQuery Mobile to make the app look and function like a true mobile app. Yesterday's article was about creating a Drupal mobile theme using jQuery Mobile.

I didn't get a chance to work on this any more today, but I thought I'd share a couple of screenshots from this Drupal mobile web app to show you what I'm doing.

A Drupal jQuery Mobile theme (tutorial)

Drupal jQuery Mobile FAQ: How do I get started developing a mobile Drupal app using the jQuery Mobile project?

In an attempt to create a mobile Drupal iPhone app, I'm currently writing a Drupal mobile app using jQuery Mobile, and although I still have a few kinks to work out, the basics are now working.

A jQuery insert text example

jQuery insert text FAQ: How do I insert text into a section of my HTML page using jQuery?

I ran into a situation recently with my new website (see my new Alaska online store demo) where I couldn't figure out how to do something with a shopping cart tool named Ubercart, so rather than fight it any longer, I decided to just use jQuery to insert text into my HTML document right where I wanted it.

A CakePHP jQuery fade out flash success message alvin January 17, 2011 - 7:22am

CakePHP flash fade out success messages: If you'd like to show fade out success messages in your CakePHP applications using jQuery, like the ones currently used by applications such as Twitter and Facebook, I thought I'd share the formula I came up with this weekend. While it includes touching a few different files, it's pretty easy, and once you've done the basic setup work you can display CakePHP fade out success messages in all of your web pages, and web applications.