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 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; }    

Try to use it

  $ (Document) .on ("change", "maker-drop-down", function () {alert ($ (this) .attr ("id"))});    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -