Skip to content

Instantly share code, notes, and snippets.

@mguilherme
Created June 23, 2014 21:41
Show Gist options
  • Select an option

  • Save mguilherme/7019d69fed4260a01bff to your computer and use it in GitHub Desktop.

Select an option

Save mguilherme/7019d69fed4260a01bff to your computer and use it in GitHub Desktop.
X-editable starter template
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>X-editable starter template</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/jquery-editable/css/jquery-editable.css" rel="stylesheet" />
<link href="//vitalets.github.io/x-editable/assets/poshytip/tip-yellowsimple/tip-yellowsimple.css" rel="stylesheet">
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="//vitalets.github.io/x-editable/assets/poshytip/jquery.poshytip.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/x-editable/1.5.0/jquery-editable/js/jquery-editable-poshytip.min.js"></script>
</head>
<body>
<div class="container">
<h1>X-editable starter template</h1>
<div>
<span>Username:</span>
<a href="#" id="username" data-type="text" data-placement="right" data-title="Enter username">superuser</a>
</div>
<div>
<span>Status:</span>
<a href="#" id="status"></a>
</div>
</div>
<script>
$(document).ready(function() {
//toggle `popup` / `inline` mode
$.fn.editable.defaults.mode = 'popup';
//make username editable
$('#username').editable();
//make status editable
$('#status').editable({
type: 'select',
title: 'Select status',
placement: 'right',
value: 2,
source: [
{value: 1, text: 'status 1'},
{value: 2, text: 'status 2'},
{value: 3, text: 'status 3'}
]
/*
//uncomment these lines to send data on server
,pk: 1
,url: '/post'
*/
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment