Article View: pl.comp.lang.javascript
Article #50702[jquery] Jak zrobić focus
From: hazet
Date: Fri, 08 Apr 2011 08:36
Date: Fri, 08 Apr 2011 08:36
29 lines
1714 bytes
1714 bytes
Zmodyfikowałem pewien skrypt w jquery,
chodzi o to, że klikając w jeden element (input), w innym dodawana jest
klasa.
Problem w tym, że po kliknięciu w drugi element (input), w którym ma być
hasło, wartość w tym pierwszym jest czyszczona.
W każdym razie, to jest skrypt:
$(document).ready(function() {
$("#login input").focus(function() {
$("#login").addClass("active");
if (this.value == this.defaultValue){
this.value = '';
}
if(this.value != this.defaultValue){
this.select();
}
});
$("#login input").blur(function() {
$("#login").removeClass("active");
if ($.trim(this.value == '')){
this.value = (this.defaultValue ? this.defaultValue : '');
}
});
});
Jak zrobić aby value #login input nie było czyszczone po przejściu do
#pass input ?
Technical Details
Message-ID:
<inmhes$i3g$1@inews.gazeta.pl>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mailShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail From: hazet <hazet@no-mail.pl> Newsgroups: pl.comp.lang.javascript Subject: [jquery] Jak zrobić focus Date: Fri, 08 Apr 2011 10:36:47 +0200 Organization: "Portal Gazeta.pl -> http://www.gazeta.pl" Lines: 29 Message-ID: <inmhes$i3g$1@inews.gazeta.pl> NNTP-Posting-Host: static-ip-77-89-75-190.promax.media.pl Mime-Version: 1.0 X-Trace: inews.gazeta.pl 1302251804 18544 77.89.75.190 (8 Apr 2011 08:36:44 GMT) X-Complaints-To: usenet@agora.pl NNTP-Posting-Date: Fri, 8 Apr 2011 08:36:44 +0000 (UTC) X-User: introw X-Antivirus: avast! (VPS 110407-2, 2011-04-07), Outbound message X-Antivirus-Status: Clean User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit