Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #13210

Re: Clicking on Disabled Controls

From BootNic <bootnic.bounce@gmail.com>
Newsgroups comp.lang.javascript
Subject Re: Clicking on Disabled Controls
Date 2012-04-04 02:31 -0400
Organization BootNic Party Make your vote count!
Message-ID <20120404023145.177c2efd@bootnic.server> (permalink)
References <8t2nn7tobq7196cv20msfns6hnh6mas0of@4ax.com>

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

In article <8t2nn7tobq7196cv20msfns6hnh6mas0of@4ax.com>,
Gene Wirchenko <genew@ocis.net> wrote:


[snip]

> (I would simply like to put the focus back.) 

<script type="text/javascript">

var last;
function checkDisabled(elm) {
  var button = elm.querySelector('button');
  if (last && button.disabled) {
    last.focus();
  }
  last = null;
}

</script>

<style type="text/css">

[data-info] {
	display: inline-block;
}
button[disabled] {
	position: relative;
	z-index: -1;
}

</style>

<div>
  <input type="text" onblur="last=this;">
</div>

<div>
  <span onclick="checkDisabled(this)" data-info="reset">
    <button type="rest" disabled="disabled" onclick=
    "alert(&#39;reset button clicked&#39;)">Reset</button>
  </span>
</div>

<div>
  <span onclick="checkDisabled(this)" data-info="submit">
    <button type="submit" onclick=
    "alert(&#39;submit button clicked&#39;)">Submit</button>
  </span>
</div>

[snip]



-- 
BootNic                                                Wed Apr 4, 2012 02:31 am
  Man who scratch ass should not bite fingernails.
  *Ancient Chinese Proverbs*

Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Clicking on Disabled Controls Gene Wirchenko <genew@ocis.net> - 2012-04-03 16:57 -0700
  Re: Clicking on Disabled Controls Mike Duffy <Use_guestbook_page@website.in.sig> - 2012-04-04 00:59 +0000
    Re: Clicking on Disabled Controls Gene Wirchenko <genew@ocis.net> - 2012-04-03 21:42 -0700
  Re: Clicking on Disabled Controls BootNic <bootnic.bounce@gmail.com> - 2012-04-04 02:31 -0400

csiph-web