How to use the class from added code in the jquery function

I create html code with jquery. <span id="myspan">aa</span> <input id="btn" type="button" value="click"> Now I want to call a function created by clicking on the code class. function loadSpan() { var _html = "<a class=\"addItem\">test</a>"; $(‘#myspan’).html(_html); } $(function(){ $(‘#btn’).click(function(){ loadSpan(); }); $(‘.addItem’).click(function(){ alert("OK"); }); }) but is not working. I testing this code, and working: $(function(){… Read More How to use the class from added code in the jquery function

A field initializer cannot reference the nonstatic field, method, or property but already initialized in ctor

i couldn’t use _cloudinaryConfig because of this error: A field initializer cannot reference the nonstatic field, method, or property I’m not sure what supposed to do private IAppRepository _appRepository; private IMapper _mapper; private IOptions<CloudinarySettings> _cloudinaryConfig; public PhotosController( IAppRepository appRepository, IMapper mapper, IOptions<CloudinarySettings> cloudinaryConfig) { this._appRepository = appRepository; this._mapper = mapper; this._cloudinaryConfig = cloudinaryConfig; } string… Read More A field initializer cannot reference the nonstatic field, method, or property but already initialized in ctor