tags:

views:

59

answers:

2

Hello,

I want to .append to a div and pass the value on as html using jQuery

I want to pass a hidden <input type=hidden....> append and sending it as .html

$('#here').append(va_lue).html();

Hoping you guys understand now

Thanks Jean

+1  A: 

This? var newHtml= $(newHtml).appendTo( $('#placeToInsert') ).html();

psychotik
not working, or I am doing it wrong!
Jean
+1  A: 

OK, it's still not clear what you are asking, but I think it's this:

$('#yourDivId').append($('<input/>')
  .attr({'type': 'hidden', 'name': 'nameOfParameter', 'value': 'your value'})
);

That will add a new <input> tag to a div whose "id" is "yourDivId". The input field will be of type "hidden", and will have whatever name and value you want.

If you have a block of HTML for your input field, then you would do something like this (as @psychotik already wrote):

var inputFieldHtml = "<input type='hidden' name='whatever' value='balloons'>";
$('#yourDivId').append($(inputFieldHtml));
Pointy