0

Currently I have a JQueryMobile form which has 2 text boxes but there might be scenarios where I have to add couple of more text boxes. How to achieve this?? ...

for example user will click an add button in the screen and it'll bring up a new text box in the screen. I've tried to append but its not working properly.

How to achieve this by dynamically adding text boxes to the JQueryMobile Form??

Thanks for your time in advance.

2
  • I haven't tried using jquery mobile ui yet. Is the code different from how you do it in jquery? Commented Jul 12, 2012 at 6:05
  • logic should be same as jquery. Commented Jul 12, 2012 at 6:15

1 Answer 1

1

You said on your comment that logic should be the same with jquery. In jquery I do something like this to create new form elements:

//element where you are going to append your dynamically created element
var body = document.getElementsByTagName('body'); 

//create textbox and append it to the body of the document.
$('<input>').attr({'type' : 'text', 'placeholder' : 'some text'}).appendTo(body); 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.