开发者

show data in another cell after press enter

i have this code

<tr>
                                <td  width="300">
                                        <label for="tag">Model</label>
                                </td>
                                        <td>
                                                <td width="10">:</td>
                                        </td>
                                <td>
                                        <td>
                                                <td width="450" align="left">
                                                <input type="text" id="tags1" name="model">
                                                </td>
                                        </td>
                                </td>
                        </tr>

if i type inside textfield "E" i want inside another cell show like:

<tr>
       <td><label><h6>this version <input type.......show E>
                  <br>87.5-108.0</br></h6></label>
        </td>
</tr>

b开发者_C百科ut if type "J" will show:

<tr>
       <td><label><h6>this version <input type......show J>
                  <br>87.5-107.9</br></h6></label>
        </td>
</tr>

what's code that can make it works after press Enter?


you can follow this sample:

<table><tr><td><input type="text" id="aTextInput"></td><td id="theValue"></td></tr></table>

<script>

    document.getElementById("aTextInput").onchange = function(event) {
        //console.log(event)
        //console.log(document.getElementById("aTextInput").value)
        if (document.getElementById("aTextInput").value == "E")
            document.getElementById("theValue").innerHTML = "87.5-108.0";
        else if (document.getElementById("aTextInput").value == "J")
            document.getElementById("theValue").innerHTML = "87.5-107.9";
        else
            document.getElementById("theValue").innerHTML = "";     // clear it out if it had value before
    }

</script>


I do not understand what you what to show and where, but you could try this code for the first part when you press Enter:

$("#tags1").keyup(function(e) {
    if(e.keyCode == 13) {
        var input = $("#tags1").val();
        switch(input)
        {
            case "E":
                // show E
            break;
            case "J":
                // show J
            break;
    }
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜