我正在尝试在标签文本更改时触发一个函数.这是我的代码
$("#frameItemCode").change(function (e) {
alert("Changed");
});
Run Code Online (Sandbox Code Playgroud)
#frameItemCode
是我的标签ID,但事件没有触发.我之前尝试了一些例子,但他们没有帮助过我.这是我的HTML
<div class="input-group">
<span class="input-group-addon" @*style="width: 120px;"*@>Item Group</span>
<label class="input-group-addon" @*style="width: 120px;"*@ id="frameGroupCode"></label>
<input class="form-control" type="text" id="frameGroupName" style="">
</div>
Run Code Online (Sandbox Code Playgroud) 我正在使用javascript函数输入图像.
这是我的HTML:
<input type="file" name="filUpload" id="filUpload" onclick="" onchange="showimagepreview(this)">
<br />
<div id="before">
<img id="imgprvw" alt="" class="img-thumbnail" style="width: 250px; height: 250px;" />
Run Code Online (Sandbox Code Playgroud)
这是我的JavaScript:
function showimagepreview(input) { //image preview after select image
if (input.files && input.files[0]) {
var filerdr = new FileReader();
filerdr.onload = function(e) {
url = e.target.result;
image = url;
$('#imgprvw').attr('src', url);
//console.log(url);
//$('#imgprvw').attr('src', e.target.result);
//url = e.target.result;
//$("#imgpath").val(url);
}
filerdr.readAsDataURL(input.files[0]);
}
}
Run Code Online (Sandbox Code Playgroud)
此代码将图像转换为咬合数组,我需要使用该咬合数组调整图像大小.有没有可行的方法来做到这一点.
我将该二进制数组传递给Web服务.我的图像尺寸太高,需要很长时间,这就是我需要转换的原因.
我有HTML textbox
,我会阻止使用正则表达式添加字符.这是我的代码:
$("#CardNo").keypress(function (e) {
if (e.keyCode == "13") {
$("#CardAmount").focus();
}
else {
$(this).val($(this).val().replace(/[^0-9]/g, ''));
if ((event.which < 48 || event.which > 57)) {
event.preventDefault();
}
}
});
Run Code Online (Sandbox Code Playgroud)
我需要添加另一个用于限制textbox
长度的正则表达式部分,6
我该怎么做?