The jquery input box returns the value of the checkbox

you can print out the value of the checkbox, and the input box can not get the value

<form action="" id="iform">
        <label><input type="radio" name="testradio" id="" value=""></label>
        <label><input type="radio" name="testradio" id="" value="FKP">FKP</label>
        <label><input type="radio" name="testradio" id="" value=""></label>
        <input type="text" class="sub" placeholder="" class="getRadio">
    </form>
    
    <script>
        $(function(){
            $("-sharpiform label").click(function(){
                var str = $("-sharpiform input:radio:checked").val();
                $(".getRadio").val() = str;
            })
        })
    </script>
Mar.04,2022

two errors
1 attribute error
< input type= "text" class= "sub getRadio" placeholder= "get the value of the radio box" > multiple class writes are separated by spaces, otherwise the first declared class predominates
2jq syntax error
jq:$ (".getRadio") .Val or js:document.getElementsByClassName ("getRadio") [0] .value = str; < / code

Menu