Skip to content

Instantly share code, notes, and snippets.

@kosalvann
Created September 21, 2015 11:40
Show Gist options
  • Save kosalvann/374b158ba0e1210a24a1 to your computer and use it in GitHub Desktop.
Save kosalvann/374b158ba0e1210a24a1 to your computer and use it in GitHub Desktop.
!!!5
/[if lt IE 7] <html lang="en" class="no-js ie6">
/[if IE 7 ] <html lang="en" class="no-js ie7">
/[if IE 8 ] <html lang="en" class="no-js ie8">
/[if IE 9 ] <html lang="en" class="no-js ie9">
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"> <!--<![endif]-->
%html{lang: 'en'}
%head
<meta http-e­qui­v="­Con­ten­t-Type" conten­t="­tex­t/html" />
%meta{:name => "viewport", :content => "width=device-width; initial-scale=1.0; maximum-scale=1.0;"}
%title First HAML Page
%meta{:name => "description", :content => "This is the page description"}
%meta{:name => "kaywords", :content => "This is the page kaywords"}
%script{:type => "text/javascript", :src => "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"}
%body
%section
.left.column
%form#form-id.from-class
- for count_number in 1..5 do
%fieldset.foo
%label(class="foo" id="bar-#{count_number}")This is a checkbox #{count_number}
%input.checkbox-foo(type="checkbox")
.div-foo
%p(class="code" id="message")
This is a paragraph with many text.
%p
%img(src="http://i.imgur.com/s9IVvWm.png" width="400" class="foo" alt="This picture")
- 5.times do
%p(class="foo-bar") This is a paragraph with many text.
.right.column
- for count_para in 1..10 do
%p(class="var#{count_para}") This is #{count_para} paragraph
:javascript
$(document).ready(function() {
$("#foo").focus(function(){
var txtValue = $(this).val();
if (txtValue.length > 0) {
// ...
}
});
$("#foo").bind("click", function() {
$(".invalid").removeClass("invalid")
if ($(":invalid").length) {
$(":invalid").addClass("invalid");
return false;
}
});
$(this).focus(function() {
var $this = $(this);
$this.data('before', $this.html());
return $this;
});
$(this).live('blur', function() {
var $this = $(this);
if ($this.data('before') !== $this.html()) {
$this.data('before', $this.html());
$this.trigger('change');
//alert($this.attr('data-id'));
var msg = {};
msg['id'] = $this.attr('data-id');
msg[$this.attr('data-name')] = $this.html();
$.post('/update', msg);
}
return $this;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment