我有两个textarea:
Stopping jbossews cartridge
Sending SIGTERM to jboss:354331 ...
Stopping MySQL 5.5 cartridge
Stopping PHPMyAdmin cartridge
Waiting for stop to finish
Waiting for stop to finish
Repairing links for 1 deployments
Building git ref 'master', commit 11577ee
Using Maven mirror /var/lib/openshift/56cb57232d5271befc00009a/app-root/runtime/repo//.openshift/config/settings.rhcloud.xml
Apache Maven 3.0.4 (r1232336; 2012-12-18 14:36:37-0500)
Maven home: /usr/share/java/apache-maven-3.0.4
Java version: 1.7.0_95, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.95/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "2.6.32-573.18.1.el6.x86_64", arch: "i386", family: "unix"
Found pom.xml... attempting to build with 'mvn --global-settings /var/lib/openshift/56cb57232d5271befc00009a/app-root/runtime/repo//.openshift/config/settings.rhcloud.xml clean package -Popenshift -DskipTests'
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Picos 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ Picos ---
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ Picos ---
[debug] execute contextualize
[WARNING] Using platform encoding (ANSI_X3.4-1968 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Picos ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding ANSI_X3.4-1968, i.e. build is platform dependent!
[INFO] Compiling 102 source files to /var/lib/openshift/56cb57232d5271befc00009a/app-root/runtime/repo/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.770s
[INFO] Finished at: Tue Feb 23 13:43:53 EST 2016
[INFO] Final Memory: 8M/114M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Picos: Fatal error compiling: invalid target release: 1.8 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
An error occurred executing 'gear postreceive' (exit code: 1)
Error message: CLIENT_ERROR: Failed to execute: 'control build' for /var/lib/openshift/56cb57232d5271befc00009a/jbossews
现在我想要显示此消息<textarea id="one"></textarea>
<textarea id="two"></textarea>
一次,直到专注于另一个textarea 。
这样的事情:
text area was focused
&#13;
var el;
$("body").on('focus', 'textarea', function(e) {
if (el != $(this)) {
alert('new textarea is focused now');
}
el = $(this);
});
&#13;
如果我在第一次聚焦后从未模糊任何文本区域,则此^代码有效。但如果我模糊其中一个,那么此变量<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<textarea id="one"></textarea>
<textarea id="two"></textarea>
将为空。如何将el
永久保留到$(this)
?
答案 0 :(得分:1)
您有一个警告会模糊页面的其余部分。一旦您关闭警报对话框,文本区域将重新聚焦。这创造了一个疯狂且永无止境的循环(事件 - 警报 - 事件)。一旦发生,请使用return
退出。
答案 1 :(得分:1)
您只需使用this
代替$(this)
,就像这样:
var el;
$("body").on('focus', 'textarea', function(e) {
if (el != this) {
alert('new textarea is focused now');
}
el = this;
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<textarea id="one"></textarea>
<textarea id="two"></textarea>