title: Rails/Rspec/Capybara: Interpreting quotes for javascript string for execute script
body: <p>Given that I need to set an element's selected index with javascript in capybara by the input name...</p>
  
  <pre><code>var element = document.querySelector("select[name='user[user_locations_attributes][0][location_attributes][state]']").selectedIndex = '50';
  </code></pre>
  
  <p>What is the proper way to interpret this as a string so it can be executed in Capybara with <code>execute_script(function_name_string)</code>? Because I keep getting syntax errors, unsure how to nest the " and ' quotations.</p>