-9

How to alert the defined function :

function calPricing{ Text }

alert(calPricing());

It's not working.

Zakaria Acharki
  • 66,747
  • 15
  • 75
  • 101

1 Answers1

0

You can test whether a specific one is checked using jQuery as follows:

if ($("#radio1").prop("checked")) {
   // do something
}

// OR
if ($("#radio1").is(":checked")) {
   // do something
}

// OR if you don't have ids set you can go by group name and value
// (basically you need a selector that lets you specify the particular input)
if ($("input[name='radioGroup'][value='1']").prop("checked"))

You can get the value of the currently checked one in the group as follows:

$("input[name='radioGroup']:checked").val();
jayant
  • 116
  • 14