Sunday, 15 February 2015

Calling the function using jquery -



Calling the function using jquery -

i calling function

<script> function getvalue(){ $(document).ready(function(){ $("[type='radio']").change(function () { var hidden = $(this).prevall("[type='hidden']"); var h3 = $(this).prevall("h3"); hidden.val(h3.text()); //alert(hidden.val()); }); }); } </script>

what happens is, clicking on radio button doesnt fire function.. clicking on sec does, have used document.ready not working.. point missing? thanx :)

your setting alter hook radio buttons, when execute function first time. thus, no alter handler attached first.

remove outer function wrapper install hook on dom-ready:

<script> $(document).ready(function(){ $("[type='radio']").change(function () { var hidden = $(this).prevall("[type='hidden']"); var h3 = $(this).prevall("h3"); hidden.val(h3.text()); //alert(hidden.val()); }); }); </script>

jquery

No comments:

Post a Comment