How to use String.Format to get multiple value from radio button?

For getting more than one value let us say “ID” and “Contact” from single radio button on change event you have to write code like :

<input type=”radio” class=”radio” name=”RadioButton” value=’@String.Format(“{0}|{1}”,ID,Contact />

Now for getting these value using jquery :

<script>

$(“input[name=RadioButton]:radio”).change(function () {

var arm = $(this).val();

var arr = arm.split(‘|’);

var ID = arr[0];

var Contact = arr[1];

})

</script>

Happy Coding!!.

 

Jquery .live() running twice ?

This  happens when you click the same element again and again ,to rectify this situation just add .die before it .

$(selector).die(‘click’).live(‘click’, function () {

});

Happy Coding !!!!