Problem with adjacent function in prototype

Posted by xain on Stack Overflow See other posts from Stack Overflow or by xain
Published on 2010-04-04T14:43:57Z Indexed on 2010/04/04 14:53 UTC
Read the original article Hit count: 320

Hi, I have this code:

<input name="rz" class="required validate-string" style="margin-left:17px"      id="rz" title="Input rz value" size="23" />
<p class="msg" style="display:none;">Input rz value</p>

In the head I have:

Event.observe(window, 'load', function() {

$$("input").each(function(field){
  Event.observe(field, "focus", function(input) {
    input.adjacent('p.msg').show();
  });
  Event.observe(field, "blur", function(input) {
    input.adjacent('p.msg').hide();
  });
});

});

The idea is that when the input get the focus, the p element appears and on blur it goes away. The problem is that neither is working, and the error console shows "input.adjacent is not a function"

I'm using prototype 1.6.1 and scriptaculous 1.8.3

© Stack Overflow or respective owner

Related posts about prototype

Related posts about scriptaculous