Skip to content

Instantly share code, notes, and snippets.

@powrsurg
Last active October 16, 2015 13:30
Show Gist options
  • Save powrsurg/649d4ed613a87254f2a2 to your computer and use it in GitHub Desktop.
Save powrsurg/649d4ed613a87254f2a2 to your computer and use it in GitHub Desktop.
YyEzYj
<div id="container" tabindex="-1" aria-live="assertive">
<div id="slide_title" data-title="1">Test 1</div>
<img id="slide_img" src="http://gravatar.com/avatar/d656c4ab1e862ddb258d6250e980ab47?s=80" alt="Brian's avatar" />
<button type="button" id="next">Next Page</button>
</div>
$(document).ready(function() {
$("#next").click(function() {
if ($("#slide_title").attr('data-title') == 1) {
$("#slide_title").text("Test 2").attr('data-title', 2);
$("#slide_img").attr("src", "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png").attr("alt", "Google logo");
} else {
$("#slide_title").text("Test 1").attr('data-title', 1);
$("#slide_img").attr("src", "http://gravatar.com/avatar/d656c4ab1e862ddb258d6250e980ab47?s=80").attr("alt", "Brian's avatar");
}
$("#container").focus();
});
});
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
#slide_img { display:block; }
#next { margin-top: 10px; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment