小编yan*_*yan的帖子

如何将选定的HTML转换为Json?

我想将部分html代码保存为json作为文件,然后重新记录html代码进行编辑.知道我该怎么办?

<div id='TextBoxesGroup'>
    <div id="TextBoxDiv1">
        <label class="draggable ui-widget-content clickableLabel" id="label1" >New Text</label>
        <input id='textbox1' class="clickedit" type="text" class="draggable" class="ui-widget-content" placeholder="Text Here"/>
        <div class="clearfix"></div>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)


我是json的新手,请尽可能简化.我看过其他问题,但他们似乎没有解决我的问题

html javascript jquery json

12
推荐指数
2
解决办法
5万
查看次数

上传文件并显示在同一页面

HTML:

<input name="fileToUpload" type="file" id="fileToUpload"/>
<div id="div1"> </div>
Run Code Online (Sandbox Code Playgroud)

查询:

$(function()
{
   $("#fileToUpload").on('change', 'input' ,  function(){
   // Display image on the page for viewing
        readURL(this,"div1");

   });
});

function readURL(input , tar) {  
if (input.files && input.files[0]) { // got sth

    // Clear image container
    $("#" + tar ).empty(); 

    $.each(input.files , function(index,ff)  // loop each image 
    {

        var reader = new FileReader();

        // Put image in created image tags
        reader.onload = function (e) {
            $('#' + tar).attr('src', e.target.result);
        }
        reader.readAsDataURL(ff);

    });
} …
Run Code Online (Sandbox Code Playgroud)

html jquery

3
推荐指数
1
解决办法
2380
查看次数

标签 统计

html ×2

jquery ×2

javascript ×1

json ×1