runnane Everything that matters ++

14Feb/140

Ferjeruta

New pet project up: ferjeruta.no

This is a pure javascript offline projects where i try to implement a tool for commuters and tourists in western Norway.

  1. Manually (sigh..) create xml objects from routes on the ferryoperator's webpage
  2. jquery parse these and create a live webpage
  3. use localStorage (for the most part) to do the settings-bit

What I plan is to use phonegap to create native android and ios apps for full offline functionality. I have to a certain extent implemented a warning/notification system - but this is an online function.

Dev builds are being pushed @ git.ferjeruta.no (courtesy of trusty jenkins)

git repo: https://bitbucket.org/runnane/ferjeruta

Tagged as: , , , No Comments
18Jul/080

Checking checkboxes, not always a breeze

So, I was sitting here and debugging some code for more than three hours. And finally, I figured it out: You cannot set a checkbox as checked until you have appended it to a container.

Code that does not work:

var newEl = document.createElement('input');
newEl.type = 'checkbox';
newEl.value = 'yes';
if(value == '1'){
   newEl.checked = "checked";
}
                               
$('AttributeValue_Container').appendChild(newEl);

Working code:

var newEl = document.createElement('input');
newEl.type = 'checkbox';
newEl.value = 'yes';

$('AttributeValue_Container').appendChild(newEl);
if(value == '1'){
  newEl.checked = "checked";
}

Really annoying 😉

Filed under: HTML/JS No Comments