<commit_before>$(document).ready(function() {
  $("#show-answer-form").click(function() {
      $("#show-answer-form").toggle()
      $("#add-answer").toggle()
    })

  $("#add-answer").on("submit", function(event) {
    event.preventDefault();
    var $target = $(event.target);
    $.ajax({
      url: $target.attr('action'),
      type: "POST",
      data: $target.serialize()
    }).done(function(response) {
      $(".answers_list").append(createAnswerRow(response));
      $("#show-answer-form").toggle()
      $("#add-answer").toggle()
    })
  });
});

var createAnswerRow = function(answer){

  var html = "<div class='row'>";
      html += "<div class='vote_container col-xs-2 col-sm-1'>";
      html += "<div class='row' id='cheese_icons'>";
      html += "<a rel='nofollow' data-method='post' href='/answers/" + answer.id + "/votes'><img src='/cheese_up.png' alt='Cheese up' /></a>";
      html += "<a href='/questions/" + answer.question_id + "><img src='/cheese_down.png' alt='Cheese down' /></a>";
      html += "</div>";
      html += "<div class='vote_count'>" + 0 + "</div>";
      html += "</div>";
      html += "<div class='answer col-xs-10 col-sm-11'>";
      html += "<strong>Answer:</strong><br>" + answer.content + "<br><br>";
      html += "By " +  answer.username + "<br>";
      html += "Edited " + answer.updated_at + "hrs ago<br>";
      html += "Answered " + answer.created_at + "hrs ago<br>";
      html += "<hr>";
      html += "<a href='/answers/" + answer.id + "/comments/new'>Add Comment</a>";
      html += "<hr>";
      html += "</div>";
      html += "</div>";
  return html
};
<commit_msg>add event prevent default for add answer toggle<commit_after>$(document).ready(function() {
  $("#show-answer-form").click(function(event) {
    event.preventDefault();
    console.log("it's working!");
      $("#show-answer-form").toggle();
      $("#add-answer").toggle();
    });

  $("#add-answer").on("submit", function(event) {
    event.preventDefault();
    var $target = $(event.target);
    $.ajax({
      url: $target.attr('action'),
      type: "POST",
      data: $target.serialize()
    }).done(function(response) {
      $(".answers_list").append(createAnswerRow(response));
      $("#show-answer-form").toggle()
      $("#add-answer").toggle()
    })
  });
});

var createAnswerRow = function(answer){

  var html = "<div class='row'>";
      html += "<div class='vote_container col-xs-2 col-sm-1'>";
      html += "<div class='row' id='cheese_icons'>";
      html += "<a rel='nofollow' data-method='post' href='/answers/" + answer.id + "/votes'><img src='/cheese_up.png' alt='Cheese up' /></a>";
      html += "<a href='/questions/" + answer.question_id + "><img src='/cheese_down.png' alt='Cheese down' /></a>";
      html += "</div>";
      html += "<div class='vote_count'>" + 0 + "</div>";
      html += "</div>";
      html += "<div class='answer col-xs-10 col-sm-11'>";
      html += "<strong>Answer:</strong><br>" + answer.content + "<br><br>";
      html += "By " +  answer.username + "<br>";
      html += "Edited " + answer.updated_at + "hrs ago<br>";
      html += "Answered " + answer.created_at + "hrs ago<br>";
      html += "<hr>";
      html += "<a href='/answers/" + answer.id + "/comments/new'>Add Comment</a>";
      html += "<hr>";
      html += "</div>";
      html += "</div>";
  return html
};

{'fraction_non_alphanumeric': 0.24821640903686087, 'fraction_numerical': 0.004161712247324614, 'mean_word_length': 3.049338146811071, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '229381', 'n_tokens_mistral': 1117, 'n_tokens_neox': 1102, 'n_words': 220}