我有一个标识为phone
的文字输入。输入需要一些电话。我在删除前导零后立即获取输入值并附加国家/地区代码,因此0800657890
的数字变为800657890
。
这是代码:
var s = phone;
s = s.replace(/^0+/, '');
var cc = 380;
var p = cc+s;
var pn = p.toString();
$('#phone').val(pn);
var tel = $("#phone").attr('value');//undefined
//var tel = $("#phone").attr('value');//[object object]
alert('tel at this point is'+tel);
window.localStorage.setItem("tel",tel);
我尝试过以下两种方式获取价值:
var tel = $("#phone").attr('value');//undefined
//var tel = $('#phone').val(pn);//[object object]
我在上面的两行中得到了评论结果。
我怎样才能获得id phone
的值?。
答案 0 :(得分:0)
我确实设法以这种方式解决它
drop table if exists dbo.Items;
create table dbo.Items (
ItemId int
, RowId int
, CalculatedNum int
);
insert into dbo.Items (ItemId, RowId, CalculatedNum)
values (1, 1, 3), (1, 2, 0), (1, 3, 5), (1, 4, 25)
, (1, 5, 0), (1, 6, 8), (1, 7, 14), (1, 8, 2);
select
tt.ItemId
, sum(tt.CalculatedNum) as CalcSum
from (
select
*
, (t.RowId - 1) / 6 as Grp
from dbo.Items t
) tt
group by tt.ItemId, tt.Grp