Skip to content

Loading…

Update the display if the source is updated #2

Open
wants to merge 1 commit into from

1 participant

@swaff

On keyup in source element, the sibling display element is updated with the new content of the
textarea.

This allows for state classes to be added to modules when applying the principals of smaccs to design. Or any other modifications the user wishes to try.

@swaff swaff Added jQuery script for live updates
On keyup in source element, the sibling display
element is updated with the new content of the
textarea.
4c3cd20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 13, 2013
  1. @swaff

    Added jQuery script for live updates

    swaff committed
    On keyup in source element, the sibling display
    element is updated with the new content of the
    textarea.
Showing with 11 additions and 0 deletions.
  1. +11 −0 index.php
View
11 index.php
@@ -47,5 +47,16 @@
endforeach;
?>
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
+ <script>
+ $(function () {
+ $('.source').on('keyup', function () {
+ var display = $(this).siblings('.display'),
+ updatedHtml = $(this).children('textarea').val();
+
+ display.html(updatedHtml);
+ });
+ });
+ </script>
</body>
</html>
Something went wrong with that request. Please try again.