开发者

how to get the contents inside a div along with all html tags along with values present in text box etc tags

how to get the 开发者_StackOverflow社区contents inside a div along with all html tags along with values present in text box etc tags . The jQuery function $('#divid').html() is working in IE but the firefox i am getting the html but the values which are in text area and text box are not setting.

Thanks, Shriniket


You can't get the content correctly with html, because it only gives you innerHTML of the div element.

You can have a reference to DOM element of that div.

$("#divid").get(0);

with this reference you can move that element to any place in DOM trees.


I would continue to do as you are doing to get the html, and then use the jquery form plugin to get the values of the fields. http://malsup.com/jquery/form/#api

var value = $('#divid').fieldValue();

value will be an array of values, you may also like fieldSerialize() which return the name value pairs url encoded.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜