I 开发者_如何学Cwant 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
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));
This?
var newHtml= $(newHtml).appendTo( $('#placeToInsert') ).html();
精彩评论