Dynamically generated input fields are not affected by .click and .blur jquery css changes -


I have an HTML form that generates another field when I click on a button. The problem is that the dynamically-generated input field is not styled.

Here is my HTML form:

  & lt; Form id = "form" & gt; & Lt; Input type = "text" id = "enter" /> & Lt; Br> & Lt; / Form & gt; & Lt; Button ID = "add_field" class = "button" "& gt; add button & lt; / button & gt;  

My jQuery which generates a new field (This works ):

And here is the code that is clicked by:

When changing, the style of all text fields should be changed:

  $ ('input: text'). (Function () {$ (this) .css ('background-color', ' Css ('border', '1px solid # 0085f0');}); $ ('input: text') css ('border', '1 px solid black');});  
P> This works for all areas which I It was entered in the HTML code, not the fields dynamically generated.

Use .on to target dynamic content - The initial selector is the container that is present when the handler is bound:

  $ ("# Form "). (" Focusin "," Input: text ", function ion () {$ (this). CSS ('background-color', '# 3F3FF'). CSS ('border', '1px solid # 0085f0'); }); CSS ('background-color', '# FF'). CSS ('border', '1px solid black');});  

Object:


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

c# - NewtonSoft JArray - how to select multiple elements with LINQ -

javascript - amcharts makechart not working -