Guest User

Untitled

a guest
Jul 9th, 2015
7,717
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
  5.   <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
  6.   <meta charset="utf-8">
  7.   <title>JS Bin</title>
  8. </head>
  9. <body>
  10. <div class="well clearfix">
  11.     <textarea class="form-control"></textarea><br>
  12.     <span>140</span>
  13.     <button class="js-tweet-button btn btn-primary pull-right" disabled>Tweet</button>
  14.     <button class="js-add-photo-button btn btn-default pull-right">Add Photo</button>
  15.   </div>
  16. </body>
  17. </html>
  18.  
  19. $("textarea").on("input", update);
  20.  
  21. $(".js-add-photo-button").on("click", function() {
  22.   if ($(this).hasClass("is-on"))
  23.     $(this).removeClass("is-on").text("Add Photo");
  24.   else
  25.     $(this).addClass("is-on").text("? Photo Added");
  26.   update();
  27. });
  28.  
  29. function update() {
  30.   var extra = ($(".js-add-photo-button").hasClass("is-on") ? 23 : 0);
  31.   $("span").text(140 - extra - $("textarea").val().length);
  32.  
  33.   var disabled = !($("textarea").val().length > 0 || $(".js-add-photo-button").hasClass("is-on"));
  34.   $(".js-tweet-button").prop("disabled", disabled);
  35. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×