javascript - Undefined Variable that has already been printed on console log -
OnClick I want a dialog button to pop up, this dialog has a unique ID and there is an iframe inside it. This is my code:
$ (".inertDetailsDiv") .click (function () {var idName = $ (this) .attr ("id"); idNameBase = idName.replace ('DetailsButton', ''); iframeSRC = idNameBase + "php."; $ (" Although my console log (chrome) output
ui-id-6 Uncaught ReferenceError: idNameDialogDiv is not defined < P> I do not understand, the console outputs the log variable and then does not recognize the javascript variable.
Try to declare idNameDialogDiv to exclude that code .each () function, $ (".inertDetailsDiv") .click (function () {var idName = $ (this) .attr ("id"); on IdNameBase = Id name.replace ('DetailsButton', ''); var idNameDialogDiv = null; // Announce here. Var iframeSRC = idNameBase + ".php"; $ ("& lt; div class = 'idNameDialogDivClass' & gt; ; & Lt; / div & gt;) .dialog (); $ (". IdNameDialogDivClass") each (function (.) {$ (This) .uniqueId (); idNameDialogDiv = $ (this) .attr ("id" ); Console.log (idNameDialogDiv);}; $ ("& lt; iframe> ", {id: idNameBase, src: iframeSRC}). AppendTo ('#' + idNameDialogDiv) ; // This place Was where the error occurred)};
Comments
Post a Comment