Commit 8ca01eae authored by Vermaat's avatar Vermaat
Browse files

Live attachment of javascript event handlers

This enables attachement of these handlers to elements that are
added to the DOM later as opposed to being in the original source
HTML.
parent 25fa9bd9
......@@ -126,11 +126,12 @@ This project is sponsored by <a href = "http://www.sun.com">SUN Microsystems</a>
</p>
<script>
$(".clickbox").click(function(){
$(document).on('click', ".clickbox", function(e){
window.location=$(this).find("a").attr("href");
return false;
e.preventDefault();
e.stopPropagation();
});
$(".clickbox input").click(function(e){
$(document).on('click', ".clickbox input", function(e){
e.stopPropagation();
});
</script>
......
......@@ -29,14 +29,15 @@ function clearField(form, fieldName) {
}
$(document).ready(function() {
$('.example-input').on('click', function() {
$(document).on('click', '.example-input', function(event) {
var target = document.getElementById($(this).data('for'));
$(target).val($(this).text());
return false;
event.preventDefault();
event.stopPropagation();
});
$('.input-select').on('change', function() {
$(document).on('change', '.input-select', function(event) {
var context = document.getElementById(
$(this).data('context')).getElementsByClassName('subform'),
target = document.getElementById($(this).data('for')),
......@@ -47,6 +48,7 @@ $(document).ready(function() {
}
target.style.display = '';
return false;
event.preventDefault();
event.stopPropagation();
});
});
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment