Quantcast
Channel: VBForums - jQuery
Viewing all articles
Browse latest Browse all 58

[RESOLVED] Adding Events With Dynamic HTML Control

$
0
0
Good day,

I was able to make the adding of html textbox control working perfectly.

So here's my code for adding textboxes.
Code:

var elementCounter = 2;

// NEW BOOK TEXTBOX.
var newBookTextbox = $(document.createElement('div'))
    .attr("class", "col-md-2");

newBookTextbox.after().html('<input type="text" id="Book' + requestCounter + '" class="form-control width-skills" name="Book' + requestCounter + '" style="font-size:12px" maxlength="2">');
newBookTextbox.appendTo(multiRequestDiv);

// NEW TITLE TEXTBOX.
var newTitleTextbox = $(document.createElement('div'))
    .attr("class", "col-md-2");

newTitleTextbox.after().html('<input type="text" id="Title' + requestCounter + '" class="form-control width-skills" name="Title' + requestCounter + '" style="font-size:12px">');
newTitleTextbox.appendTo(multiRequestDiv);

As you can see I'm creating two textboxes under the name of "Book" and "Title". Now what I want is to append an OnBlur event upon creating of new instance of textbox "Book" only. So everytime they type on "Book(x)" an alert will be prompted.

Can anyone help me about this.. Thank you

Viewing all articles
Browse latest Browse all 58

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>