Click on a module to make it disappear and let its contents be displayed elsewhere?

clipboard.png
as shown in the figure above, click 2 to get its value, and let it hide itself, showing the value of the obtained 2 in 1. Click 1 again, and the content in 1 disappears and the content in 2 appears again. Others are similar. Is there any big god to help solve it? The
code is as follows:

< html >

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=eage,chrome=1"/>
    <meta name="viewport"  id="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <title></title>
    <link rel="stylesheet" type="text/css" href="css/common.css"/>
    <script src="js/jquery-1.11.1.min.js"></script>
    <style>
        .answerul{overflow:hidden;padding:20px;}
        .answerul li{width:30px;height:30px;background:blue;border-radius:3px;-webkit-border-radius:3px;float:left;margin-right:15px;margin-bottom:10px;}
        .answerul li input{width:30px;height:30px;background:none;cursor: pointer;text-align:center;font-size:16px;color:-sharpfff;}
        .testul{overflow:hidden;padding:20px;}
        .testul li{width:30px;height:30px;float:left;margin-right:15px;margin-bottom:10px;}
        .testul li i{width:30px;height:30px;background:-sharp204D74;border-radius:3px;-webkit-border-radius:3px;display:block;text-align:center;line-height:30px;font-size:16px;color:-sharpfff;font-style:normal;cursor: pointer;}
    </style>
</head>
<body>
    <ul class="answerul">
        <li>
            <input type="text" readonly class="txt"/>
        </li>
        <li>
            <input type="text" readonly class="txt"/>
        </li>
        <li>
            <input type="text" readonly class="txt"/>
        </li>
        <li>
            <input type="text" readonly class="txt"/>
        </li>
    </ul>
    <ul class="testul">
        <li>
            <i></i>
        </li>
        <li>
            <i></i>
        </li>
        <li>
            <i></i>
        </li>
        <li>
            <i></i>
        </li>
        <li>
            <i></i>
        </li>
        <li>
            <i></i>
        </li>
        <li>
            <i></i>
        </li>
        <li>
            <i></i>
        </li>
        <li>
            <i></i>
        </li>
        <li>
            <i></i>
        </li>
        <li>
            <i></i>
        </li>
        <li>
            <i></i>
        </li>
        <li>
            <i></i>
        </li>
        <li>
            <i></i>
        </li>
        <li>
            <i></i>
        </li>
        <li>
            <i></i>
        </li>
        <li>
            <i></i>
        </li>
        <li>
            <i></i>
        </li>
    </ul>
</body>
<script type="text/javascript">
    $(function(){
        $(".testul li").click(function(){
            var txt=$(this).find("i").text();
            $(this).find("i").hide();
        });
    });
</script>

< / html >
how to implement the jq code?

Mar.22,2021

add click events, get click on target's innerhtml, to set its css display:none, and then set its innerhtml to input's value


it's relatively easy to write one for you first, it's just to realize the logic of the first grid you asked, and the later judgment needs you, you can also add id, to them separately to control it, and you don't have to say much about it. It's very simple to paste the code to


logic. First, disappear: that is, hide the clicked object. Use $(this). Hide ();. Move the content somewhere else, where there are two objects, a container object and a content object. The content is the $(this). Text (), container object, considering that you may want to put four boxes one by one, you can record it in the form of an array and put it one by one.

Menu