I have a function for the class .myclassA, inside this function I capture the id of the particular element chose and I put it inside a variable inputid. This function also brings another function for another class(.myclassB), which is inside the first function. Do you guys have any idea how I can pass the variable inputid from the first function to the function inside it?
Thanks for all your help
$('.myclassA').click(function(){
var inputid = $(this).attr('id');
$('.myclassB').click(function(inputid){
var thisid = $(this).attr('id');
$(inputid).val(thisid);
});
//$('seqa').click();
});
//$('#empcriddi').focus();
You don’t need to “pass” it, just don’t name the local variable with the same name, like this:
Though this won’t quite work either, and there’s no reason to go a lookup of an element you already have so just maintain a reference, for example: