$(document).ready(function () {
function somefunction(input) {
$('div').html(input);
}
$("#assign").click(function () {
//assign the value only
somefunction("from assign to putput")
});
$("#output").click(function () {
//run the function
somefunction();
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<input type="button" id="assign" value="assign" />
<input type="button" id="output" value="output" />
<div></div>
How to assign a value on a function in one button and run that function on another button?
Any suggestion is accepted.