Advertisement
PaulLT

Untitled

Oct 28th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     $(document).ready(function(){
  2.         var color = "#FFFFFF";
  3.         $("#colorbutton").click(function(){
  4.             $("#colorchart").css("display", "block");
  5.         });
  6.         $("#colorchart > table > tbody > tr > td").click(function(){
  7.             color = $(this).css("background-color");
  8.             console.log(color);
  9.         });
  10.         $("#boldbutton").click(function(){
  11.             $("#derp").html($("#input")[0].selectionStart + ' - ' + $("#input")[0].selectionEnd);
  12.         });
  13.         $("#italicbutton").click(function(){
  14.             var tag1 = "[i]";
  15.             var tag2 = "[/i]";
  16.             string = $("#input").val();
  17.             start = $("#input")[0].selectionStart;
  18.             end = $("#input")[0].selectionEnd;
  19.             console.log("string: \"" + string + "\"; start: " + start + "; end: " + end);
  20.             $("#input").val(string.slice(0, start) + tag1 + string.slice(start, end) + tag2 + string.slice(end));
  21.         });
  22.     });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement