When I click on any of the buttons, it tells me showElement is not defined.I'm looking to create a reusable function called showElement which can be called whenever I want to show a div by passing an id of that div. What am I doing wrong? https://jsfiddle.net/2taswyy6/20/
This is my html:
<button onclick="showElement('div1')">
Show Div 1
</button>
<button onclick="showElement('div2')">
Show Div 2
</button>
<div hidden id="div1">Showing Div 1</div>
<div hidden id="div2">Showing Div2</div>
updated: This is my jQuery:
function showElement(id){
$('#'+id).show()
}