Click here to Skip to main content
15,880,608 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone,
I need to call a jquery function that will assign an integer value present in textbox to checkbox checked..I have a string as value now to that checkbox in wordpress...on checkbox click it should take value of textbox which is hidden...please help...
Posted
Comments
AMIT AGRAWAL57 19-Aug-13 5:53am    
please post some code to understand your problem.

1 solution

Hi Radhika,

Your question is not clear.But still I have did some programming by considering your requiment.

Script:
JavaScript
<script type="text/javascript">
        $(function () {
            $(".chb").click(function () {
                if (this.checked) {
                    var txtVal = $("#txt").val();
                    $(this).val(txtVal);
                }
            });
        });
</script>

HTML:
HTML
<input type="text" id="txt" /><br />
<input type="checkbox" class="chb" value="10" />A<br />
<input type="checkbox" class="chb" value="20" />B<br />
<input type="checkbox" class="chb" value="30" />C<br />
<input type="checkbox" class="chb" value="40" />D<br />
<input type="checkbox" class="chb" value="50" />E<br />
 
Share this answer
 
v2
Comments
Radhika Vyas 21-Aug-13 2:31am    
Hi shobana...Thanks for ur reply...it suits to some extent to my requirement..Actually I need to store muliple checkboxes values in multiple textboxes and I tried and solved it myself..Thanks for ur response.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900