0

I have a jquery mobile page that has a textbox and a button. When the button is clicked, I want to add an additional textbox. However, the new textbox is not styled properly. I've tried using .trigger('create') when appending my textbox but it is still not styling.

Here is a working fiddle

And here is my code:

HTML:

<div id="auth1" name="auth1">
    <label>Name of the Author</label>
    <div id="auth-box">
        <input type="text" name="auth1" placeholder="John Smith" style="width: 200px;" value="" />
    </div>
    <input type="button" data-inline="true" value="Add Author   " onclick="addtxt()" />
</div>
<input type="hidden" id="auth_cnt" name="auth_cnt" value="1">

Javascript:

<script type="text/javascript">
    function addtxt() {
        var div = document.createElement('div');
        div.innerHTML = '<input type = text name = "auth">';
        $('#auth-box').after(div).trigger('create');
    }
</script>
Nad
  • 4,605
  • 11
  • 71
  • 160
DannyD
  • 2,732
  • 16
  • 51
  • 73

0 Answers0