title: How to use plain javascript to delete with confirm in rails?
body: <p>I don't have jquery_ujs in my project, So I am trying to get a pop up when clicked on a delete button. </p>
  
  <p>But the item is getting deleted, even if I press cancel or ok.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>= button_to "Remove Item", item, method: :delete, onclick: 'remove_item()'
  
  function remove_item(event){
      if (!confirm('Are you sure, you want to delete the item')) {
         event.preventDefault();
      }
    }
  </code></pre>
  
  <p>Can you help me solve this? Thank you.</p>