javascript - Why does alert return an 'undefined' variable value? -
A function to me that connects the input and dropdown boxes dynamically clicked on the '+' icon is. However, when the dropdown is changed, then Try to use it alert returns
undefined . Why do you do?
jQuery (document) Kchange ( "K-marker drop-down", function () {alert (jQuery (this) .attr ( "id"));}); // function addInputBox () {jQuery ( "# insert-question-inbox") Append ( '& lt; div id = "question -' + i + '- div" & gt; & lt; div id = " remove-question- '+ I +' "class =" ui-icon ui-icon-minus remove-question "& gt; & lt; / div & gt; & lt; input class =" Q "input type =" Text "id = question - '+ i +' value = question - '+ i +' / & gt; & lt; select id =" question - '+ + + - drop-down "category =" manufacturer-drop- down "> gt; & lt; base & gt; Choose & lt; / options & gt; & lt; & Lt; / select & gt; & lt; br / & gt; & lt; option value =" multiple choice " Div & gt; '); I + = 1; }
$ (Document) .on ("change", "maker-drop-down", function () {alert ($ (this) .attr ("id"))});
Comments
Post a Comment