[英]Get textarea value inside iframe
我可以使用當前代碼從textarea
獲取文本。 但是我想在iframe中包含的textarea
上獲得它嗎?
我當前的代碼是
<script> function get_text() { var value = $('textarea').val(); $('#show_value').html(value); } </script> <textarea></textarea> <div id="show_value"></div> <a href="#" onclick="get_text()">Click me to show text</a>
我嘗試像下面的代碼一樣編輯該代碼,但是沒有用
<script>function get_text() { var value = $('iframe textarea').val(); $('#show_value').html(value); } </script> <iframe src='http://check0909.vv.si/s.html'></iframe> <div id="show_value"></div> <a href="#" onclick="get_text()">Click me to show text</a>
您可以在此處查看我的演示http://check0909.vv.si/
預先感謝您的任何幫助!
像輸入名稱和ID一樣,您應該可以使用這樣的名稱。
$('iframe[name=select_frame]').contents().find('#select_name').val();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.