Couple of things, 1) I highly suggest using json format to code
javascript.  Keeps things object oriented.  2) What are you attempting
to do with the ").attr("id"

var myObj = {
  initform : function() {
 // To find every input field into myform and attach mykeyupfct
  $("[EMAIL PROTECTED]'password']:visible,input
[EMAIL PROTECTED]'text']:visible").keyup(function()  {
    mykeyupfct(this);
  });
}

to run:

myObj.initForm();


On Nov 27, 9:41 am, Soledad <[EMAIL PROTECTED]> wrote:
> I'm trying to use the folowing code
>
> <!-- -------------------
> HTML botom of the page
> -------------------- -->
> <script>initform()</script>
>
> /*******
> Javascript
> *******/
> function initform() {
> // To find every input field into myform and attach mykeyupfct
>         $("[EMAIL PROTECTED]'password']:visible,input
> [EMAIL PROTECTED]'text']:visible").attr("id",function(){
>                 $(this).keyup(function()  {mykeyupfct(this);});
>         })
>
> }
>
> function mykeyupfct(myfield) {
> var sid="#"+myfield.id
> var skey
> $(sid).keyup(function(e) {
>         skey = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
>         alert("never alert : " + skey);
>
> });
>
> alert("always alert but no skey for "+sid);
>
> }
>
> Im also tryinng :
> $(sid).bind('keyup', function(e) {skey=e.keyCode; alert(skey); })
> but it's the same problem
>
> Thank's a lot for your help
>
> A beginner jQuery
> Soledad

Reply via email to