I have the Browser render source code in HTML following format. There is button and on that button click one java-script function is called and I want the Return value from java script function. Return value from that function. Please refer below code for your reference,
Thanks, Digambar K.
This is way to get return value using javascript:
function myFunction(value1,value2,value3)
{
}
var returnValue = myFunction("1",value2,value3);
if(returnValue.value1 && returnValue.value2)
{
//Do some stuff
}
This is way to get return value using jquery:
function getMachine(color, qty) {
var retval;
$("#getMachine li").each(function() {
var thisArray = $(this).text().split("~");
if(thisArray[0] == color&& qty>= parseInt(thisArray[1]) && qty<= parseInt(thisArray[2])) {
retval = thisArray[3];
return false;
}
});
return retval;
}
Use:
OnClientClick="return //javascript code"
instead of
onclick
Try this:
var returnValue;
$(document).ready (function(){
var myButton = $("#yourbuttonsid");
var originalEventHandler = myButton[0].onclick;
myButton.click(function(e) {
returnValue = originalEventHandler();
});
});
//Here you can do anything with returnValue
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.