利用Jquery获取、设置iframe中元素

<iframe id="iframe" src="'+url+'"></iframe>';

//iframe加载完成后

$("#iframe").load(function(){

  //设置class="name"的值为jeffson

  $(this).contents().find('.name').val("jeffson");

  //设置class="content"的值为abcdefg

  $(this).contents().find('.content').html("abcdefg");

  //获取class="name"的值

  $(this).contents().find('.name').val();

  //设置单选按钮为选中状态
  $(this).contents().find("input[@type='radio']").attr("checked","true"); 
})

  

原文地址:https://www.cnblogs.com/qhorse/p/5442530.html