[dancer-users] Getting param name of dynamically named <input> tag

Richard Reina gatorreina at gmail.com
Fri Oct 9 22:02:08 BST 2015

I have a input tag in a form:

<div class="col-xs-4 col-md-4">
	  <div id="p_scents">
              <label for="p_scnts"><input type="text" id="p_scnt"
size="20" name="p_scnt" value="" placeholder="email address"

Which gets it's name from the JS function below. However, that name I
can't figure out. I have tried
p_scnt_1 but it comes back undefined. Any ideas what the param name
would be for each sequentially added item?
Here's a working example of the form: http://jsfiddle.net/jaredwilli/tzpg4/4/

$(function() {
        var scntDiv = $('#p_scents');
        var i = $('#p_scents p').size() + 1;

        $('#addScnt').live('click', function() {
                $('<p><label for="p_scnts"><input type="text"
id="p_scnt" size="20" name="p_scnt_' + i +'" value=""
placeholder="Input Value" /></label> <a href="#"
                return false;

        $('#remScnt').live('click', function() {
                if( i > 2 ) {
                return false;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20151009/fb932d25/attachment.html>

More information about the dancer-users mailing list