小编Ric*_*dMc的帖子

jQuery .prop("disabled",false)未启用输入

在页面加载禁用输入后,我遇到了重新启用输入的问题.

我正在使用两个输入来接受两个日期,但我希望第二个输入在第一个输入有值之前不会启用.

<div id="date1" data-role="fieldcontain">
    <label for="date1-start" id="date1-startlbl">Start Date</label>
    <input name="date1-start" id="date1-start" type="date" data-role="datebox"data-options='{"mode": "calbox", "overrideDateFormat": "%Y-%m-%d", "beforeToday": true}' data-theme="a" onchange="showdate()"/>
    <label for="date1-end" id="date1-endlbl">End Date</label>   
    <input name="date1-end" id="date1-end" type="date" data-role="datebox" data-options='{"mode": "calbox", "overrideDateFormat": "%Y-%m-%d", "beforeToday": true}' data-theme="a" onchange="datechart()"/>
</div>
Run Code Online (Sandbox Code Playgroud)

第二个输入在页面加载时成功禁用.

$("#date1-end").prop("disabled", true);
Run Code Online (Sandbox Code Playgroud)

第一个日期有一个调用以下函数的onchange事件

function showdate(){
    if ($("#date1-start").val() != null){
        if ($("#date1-end").val() != ""){
            datechart();
        }
        else{
            $("#date1-end").prop("disabled", false);
            $("#date1-end").trigger('change');
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

当到达时,该函数被调用并且prop("disabled",false)没有任何错误,但输入仍然被禁用.我正在使用的触发器('更改')是尝试刷新元素,但没有它就存在同样的问题.

我从旧版本的Jquery尝试了.attr的不同变体,但我也遇到了同样的问题.

我使用的是Jquery 1.9.1,Jquery-mobile 1.3.1和phonegap 2.7.0

任何指示我正确方向的帮助将不胜感激.

html javascript jquery jquery-mobile cordova

19
推荐指数
3
解决办法
5万
查看次数

$(document).on("input",".SomeClass")适用于Chrome但不适用于IE

我有一个带有contenteditable标签的span,我有一个用于检测输入的函数..

//TextArea
<span class="SomeClass" contenteditable></span>

//Function
$(document).on("input", ".SomeClass", function () {
    console.log("input entered");
});
Run Code Online (Sandbox Code Playgroud)

这适用于Chrome,但不适用于IE 11或更低版本.我似乎无法在网上找到任何提及它,并想知道是否有人可以给我如何使这项工作或更好的方法的信息.

谢谢

html javascript jquery internet-explorer google-chrome

4
推荐指数
1
解决办法
2079
查看次数

如何使用 wix 自定义操作停止 .MSI 安装

我正在使用自定义操作在安装之前进行一些检查。如果这些检查失败,我希望安装不会启动。

有没有办法优雅地做到这一点?

.net c# windows-installer wix

3
推荐指数
1
解决办法
2383
查看次数

WindowsFolder属性作为exe地址的一部分不起作用

尝试让wix安装程序终止进程,根据我在网上发现的信息,这似乎是一种方法:

<Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="WindowsFolder" Name="WINDOWS"/>

<Property Id="QtExecCmdLine" Value='"[WindowsFolder]System32\taskkill.exe" /F /IM Foo.exe'/>
<CustomAction Id="KillTaskProcess" BinaryKey="WixCA" DllEntry="CAQuietExec" Execute="immediate" Return="ignore"/>
Run Code Online (Sandbox Code Playgroud)

我在构建项目时遇到的问题将引发有关Windows属性的以下错误:

The 'QtExecCmdLine' Property contains '[WindowsFolder]' in its value which is an illegal reference to another property.  If this value is a string literal, not a property reference, please ignore this warning.  To set a property with the value of another property, use a CustomAction with Property and Value attributes. 
Run Code Online (Sandbox Code Playgroud)

我尝试使用[#WindowsFolder]代替,它可以消除错误,但不能解决问题。使用完整地址(C:\ Windows \ System32 \ taskkill.exe)代替该值确实有效,但我想避免这种情况。

installation wix

3
推荐指数
1
解决办法
1302
查看次数

以编程方式从wcf配置文件中的单独服务获取baseAddresses的值

说我有以下wcf配置文件

<services>
  <service name="Service" behaviorConfiguration="Default">
    <endpoint address="rest" behaviorConfiguration="Default" binding="webHttpBinding" bindingConfiguration="WebBinding" contract="CaptureService"/>
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8501/service/service1.svc"/>
      </baseAddresses>
    </host>
  </service>
  <service name="otherService" behaviorConfiguration="Default">
    <endpoint address="start" behaviorConfiguration="Default" binding="webHttpBinding" bindingConfiguration="WebBinding" contract="CaptureService"/>
    <host>
      <baseAddresses>
        <add baseAddress="http://localhost:8501/service/service2.svc"/>
      </baseAddresses>
    </host>
  </service>
</services>
Run Code Online (Sandbox Code Playgroud)

如何循环访问配置以检索baseAdresses的值?这是我想要这样做的方法:

    public ServiceHost()
    {
        //read the config here

        this.service = svcType;
        this.scheme = new UriSchemeKeyedCollection(//list of values here);

        //add certain behaviours
        base.InitializeDescription(this.service, this.scheme);
        this.Description.Behaviors.Add(this);
    }
Run Code Online (Sandbox Code Playgroud)

我觉得我可能会以完全错误的方式解决这个问题.有没有人看到任何本质上错误的东西?

c# wcf

2
推荐指数
1
解决办法
1388
查看次数

使用RazorEngine插入html以呈现为HTML填充模板

我在HTML模板中呈现html时遇到问题。我目前正在使用razorEngine填充我们随后在电子邮件中使用的模板。我在渲染方面遇到的信息是一个URL。由于客户的要求,我们不能在电子邮件中包含可点击的链接,因此,我必须将url作为纯字符串,电子邮件客户端的问题在于,无论您将其定义为链接与否。为了避免这种情况,我在整个链接中添加了两个零空间图像来打破它。

这是填充模板的代码:

Engine.Razor.Compile(content, "template");
Engine.Razor.Run("template", null, data)
Run Code Online (Sandbox Code Playgroud)

传入的数据是一个JObject:

{
    "Code": "235466",
    "FirstName": "First",
    "LastName": "Last",
    "URL": "<p>http<img src=\"\" width=\"0\" height=\"0\">s:<img src=\"\" width=\"0\" height=\"0\">//test.<img src=\"\" width=\"0\" height=\"0\">test.<img src=\"\" width=\"0\" height=\"0\">com/account/forgotpassword/</p>"
}
Run Code Online (Sandbox Code Playgroud)

模板中的标签通常与模板匹配,如下所示:

  • @ Model.FirstName
  • @ Model.LastName
  • @ Model.LastName

除了我尝试呈现为html的网址:

  • @Raw(Model.URL)

尝试输入值时会引发以下错误:

Microsoft.CSharp.RuntimeBinder.RuntimeBinderException:最佳重载方法匹配'RazorEngine.Templating.TemplateBase.Raw(string)'有一些无效的参数

如果将URL直接放入Raw(),它将正常工作:

@Raw("<p>http<img src="" width="0" height="0">s:<img src="" width="0" height="0">//test.<img src="" width="0" height="0">test.<img src="" width="0" height="0">com/account/forgotpassword/</p>")
Run Code Online (Sandbox Code Playgroud)

谁能看到我在这里想念的东西?

html c# razor

2
推荐指数
1
解决办法
479
查看次数