I have this html button that I am trying to pass the id to a function
<button class= "btn1" id="buttonid1">Set Text</button>
<button class= "btn1" id="buttonid2">Set Text</button>
Here is the Javascript to it
$(".btn1").click(function(){
doSomething();
});
function doSomething() {
goUrl = 'http://www.example/'
+ $(this).attr('id');
window.location = goUrl;
}
I want the function to redirect the browser to a different website based on button pressed