当页面首次自动加载时,有什么方法可以将输入文本值或字段数据复制到同一页面上的另一个字段?
How about: document.getElementById('secondField').value = document.getElementById('firstField').value
No JQuery =)
Using jQuery:
$( 'input[name="fieldone"] ).val( $( 'input[name="fieldtwo"]' ).val() );
See http://api.jquery.com/val/ and http://api.jquery.com/attribute-equals-selector/ for specifics.
Without using jQuery you can try (in supported browsers):
document.querySelectorAll('input[name$="fieldone"]').value = document.querySelectorAll('input[name$="fieldtwo"]').value;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.