How to set values of dropdown and radio in jquery by text?

How to set values of dropdown and radio in jquery by text?

For example: I have two variables
var radioText="XYZ";
var ddText="New York";


I want to set radio and drop down box values using these variables and I don't know how to do that.


html demo code


  1. Friend Name 
  2. <input type="radio" name="Friends" value="1" checked="checked">ABC</input>
  3. <input type="radio" name="Friends" value="2">XYZ</input>

  4. <br>

  5. <select id="ddCity">
  6.       <option value="1" selected>India</option>
  7.       <option value="2">New York</option>
  8.       <option value="3">Japan</option>
  9. </select>


Thanks,
Mayur