Reputation: 517
I am working on a dynamic form in which I need to create a dynamic input field on the press of a button. Here is the JQuery code:
$(this).find(".inner").html(html_ + "<input type='text' class='TB' id='" + TxtID + "' />");
This is the created DOM markup:
<input type="text" class="TB" id="S0Q0_TB0"/>
This input field is working in Chrome and Safari (Enabled for edit), but it seems to be disabled in Opera, Firefox and IE 9.
Couldnt find a relevant question in the KB. Need a quick solution
Thanks in advance :)
Upvotes: 0
Views: 272
Reputation: 5803
You can use append instead of .html
you are also appending but this is very easy to implement..
or if i am understanding your problem then any issue related to browser compatibility.. give browser compatibility..
like this->
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
or try this>>
jQuery('#mainField').find('tr:last').before("<tr><td colspan='3'> </td></tr ><tr><td></td><td align='center'></td><td></td></tr>");
jQuery('#mainField').find('tr:last').prev().find('td:nth-child(1)').append(newField);
jQuery('#mainField').find('tr:last').prev().find('td:nth-child(2)').append(newField2);
jQuery('#mainField').find('tr:last').prev().find('td:nth-child(3)').append(newField3);
Upvotes: 0
Reputation: 2620
I tested it on firefox and Internet Explorer, and it works. http://jsfiddle.net/mDDPW/2/
Are you sure it's not a side effect for somewhere else in your code ?
Upvotes: 1