我在表單中有兩個文本框和一個複選框。 我需要創建一個函數javascript函數將第一個txtbox值複製到複選框更改事件上的第二個文本框。根據更改事件上的複選框從文本框中獲取值
我使用下面的代碼,但它在第一次顯示null複選框爲true。
function ShiptoBill()
{
var billing = document.getElementById("txtbilling").value;
var shipping = document.getElementById("txtshipping").value;
var check = // here i got checkbox checked or not
if(check == true)
{
// here I need to add the txtbilling value to txtshipping
}
}
嚴格使用Javascript,還是你願意使用jQuery? – tempranova
@tempranova他標記jquery..go給jquery答案..OP應提供更多信息 – guradio
@tempranova Javascript – User