HelpSpot Help Desk Software | HelpSpot Blog | HelpSpot Support

Clicking custom button tries to submit request?

Hi there!

I’ve been working on a Chrome extension for my company to integrate some API information into HelpSpot. Currently, we would like to add the equivalent of a “Search Again” button, but when clicked, the page seems to make an attempt to submit the request, and gives an alert like this:

I am a pretty novice web/extension developer, so any help is appreciated. For reference, here’s the button code and how I insert it into HelpSpot.

$("#emailheader").html('<div id="emailheader" class="box_title">&nbsp;<button   id="search_again">Search Again</button>&nbsp;|&nbsp;User Details for ' + email + '&nbsp;<a     href="' + internalUserIdNum + '" target="_blank">(Click to View on</a></div>');

Honestly, as far as I can tell, the button shouldn’t do anything when clicked right now, unless there’s something in HelpSpot trying to do something. Kinda at a loss here.

Edit: Fixed formatting…

Replying since I can’t find the edit button. I figured this out- button elements without a type default to type=“submit”, which as far as I can tell tries to submit the request regardless of the button ID or name. To fix this, I used the following tag:
<button type="button" id="search_again"> Search Again</button>

Thank you!