English 中文(简体)
jquery/ajax , 装页和收音机
原标题:jquery/ajax problem with page loaded and radio checked
  • 时间:2010-07-26 15:42:48
  •  标签:
  • jquery

我装上一个带有麻风机/频率的网页,内有一只可以检查的无线电台,一米试图获得经过检查的无线电台的价值,但我无法在页面装上,而如果我能看到另一台无线电台,就会装上。 这里的例子有:

html:

<form id="form1">
<input type="radio" name="a" value="10"> a
<input type="radio" name="a" value="15"> b
<input type="radio" name="a" value="19"> c
</form>

jquery:

$(function(){
var ch=$("input[name= a ]:radio:checked");
    $.each(ch, function()
           {
               var chv=$(this).val();
               alert(chv);
           });

$(":radio[name= a ]").click(function(){
    var ch=$("input[name= a ]:radio:checked");
    $.each(ch, function()
           {
               var chv=$(this).val();
               alert(chv);
           });
});
});

Thanks in advance. ciao h

最佳回答

我认为,你面临的问题是,你没有把该守则列入<条码>文件>ready(包装”。 你可以尝试这样做:

$(document).ready(function(){
 // get value if clicked
 $("input:radio[name= a ]").click(function(){
   var value = $(this).val();
   alert(value);
 });

 // get value on load
 var valueOnLoad = $("input[name= a ]:radio:checked").val();
 alert(valueOnLoad);

});
问题回答

暂无回答




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签