newTextBoxDiv.after().html('<div id="hoteldiv' + counter + '">'+'<input type="text" name="tripdetails[0][hoteldetails][' + counter + 
          '][name]" id="textbox' + counter + '" value="" >'+
          '<input type="text" name="tripdetails[0][hoteldetails][' + counter + 
          '][number]" id="textbox' + counter + '" value="" >'+
          '<input type="text" name="tripdetails[0][hoteldetails][' + counter + 
          '][address]" id="textbox' + counter + '" value="" >'+'<br><br>'+
          '<input type="text" name="tripdetails[0][hoteldetails][0][contact][' + counter + 
          '][name]" id="textbox' + counter + '" value="" >'+
          '<input type="text" name="tripdetails[0][hoteldetails][0][contact][' + counter + 
          '][number]" id="textbox' + counter + '" value="" >'+'</div>'
          +'<input type=button value="Add Con" id="addcon' + counter + '">'+
'<input type=button value="Remove con" id="removecon' + counter + '">');

I am not getting value of addcon1 or not getting value click on addcon1

     $("#addcon1").click(function () {
        alert("demo");
        });

yes available

Do you have a version online we can see? Without that it'll be a blind guess as to what might cause it.

hi ramsiva,

one more test have to check

please check how many addcon1 elements existed in your outputted html?

in the above code click event not works fine if html contains more than one addcon1 or else nothing found.

check it once

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.