tags:

views:

38

answers:

1

The follow code does not work in IE:

<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript">
    $(function(){
            $(":text[id*=txtPopCEP]").keypress(function(e){
                  var tecla = (e.which) ? e.which : e.keycode;
                  if(tecla == 13)
                  {
                      __doPostBack('ctl00$ContentPlaceHolder1$ImageButton1', '');

                  }
            });
    });
</script>

It doenst call the doPostBack function.But in FF it works...Any ideias?

ImageButton1 code output:

    <input type="image" name="ctl00$ContentPlaceHolder1$ImageButton1" id="ctl00_ContentPlaceHolder1_ImageButton1" src="imagens/btCEP.jpg" style="border-width:0px;" />
A: 

Sometimes IE doesn't like the ":text[id*=txtPopCEP]" conditional in JQuery.

I suggest adding: CssClass="txtPopCEP" to the ImageButton...

Then making your conditional $(".txtPopCEP")

Matt Shaver
the problem isnt in selector,because its getting correct textbox,the problem is with the __doPostBack function
Another issue could be is that you're using a hard coded ClientId
Matt Shaver
I would suggest having the code behind populate the JavaScript with a ImageButton1.ClientId
Matt Shaver