There is the following code:
$('#PROGRAMS .options > div').click(function(){ var pid = this.value; $('#group .options > div').each(function(index, elem){ console.log(pid); }); });
From the function in each()
pid
variable is not visible. How to send it there?
undefined
, does thediv
have anyvalue
? This code works fine right on this page $ ('. Question-body'). Click (function () {var pid = 123; $ ('. Question-body'). Each (function () {console.log ( pid);});}); - etkivar pid = this.getAttribute('value')
- co11ter