0
Multi functional buttons?
Can you make a button activate two things? I have two separate buttons which I would like to merge into one. One of them launches a progress bar and the other opens a alert box with <script></script>.
2 Answers
+ 2
yes it can do multiple functions
<button onclick="merged()">click</button>
<script>
function merged(){
alert_function();
progress ();
}
</script>
you can't add multiple onclick it will overwrite, so the one function set as onclick can have two functions
0
Can you show the code? Put the link to code playground maybe?
You want the two actions being executed on one click, or you want two distincts zones in one button?
Did you need to avoid css? I guess JS not, because you talk about 'altert box' and '<script></script>...
Well, for at least these context/behaviour, the answer is yes: you can ;)