i am generating a value to a varible on a click event.
Which i need to use globally or out of it function event.
$("#Coil_Data tr").on('click', function (){
var selectedcoilrowid = $(this).closest('tr').find('#Coil_ID').text()
$('#selected_coil_id_title').text('Fan for the Coil ID : '+selectedcoilrowid)
})
Though variables should be avoided to be declared global, you can use the global object.
$("#Coil_Data tr").on('click', function (){
global.selectedcoilrowid = $(this).closest('tr').find('#Coil_ID').text()
$('#selected_coil_id_title').text('Fan for the Coil ID : '+global.selectedcoilrowid)
})