开发者

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

开发者 https://www.devze.com 2022-12-14 02:53 出处:网络
how to get the 开发者_StackOverflow社区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

精彩评论

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