My jQuery listener won't recognize my trigger click -


i trying dialog box pop if forgets fill out field on form using c# , aspx. trigger in header , looks this.

 function checksalesman() {    alert("alert!!!!!!!!!");    $('#opener').trigger('click');   } 

this clicks hidden button. button has id opener. listener have in body of code. used trigger dialog box.

 $("#opener").click(function () {      alert("opendialog!");      stopsubmit();       $("#dialog").dialog("open");   }); 

the reason down here because right above javascript tag in, dialog box gets established. have tried have listener in header not work there. under dialog box established place can work.

i have tried move the trigger underneath listener , trigger function never run. trigger function called aspx label having code below inserted .text attribute.

<script>checksalesman()</script> 

i have tried moving both listener , trigger header, , body, , filled both were. none of has worked. changed id of hidden button hoping might once again, nothing. see alert in trigger not in listener.

i don't understand why isn't working. myself , guy working on know, should work.

there nothing wrong code you've posted it. problem lies elsewhere. here's jsfiddle:http://jsfiddle.net/dsyua/

  1. is label set not htmlencode text? otherwise, script tags not interpreted correctly.
  2. is both function , hook code above call code? if not, don't exist yet, , can't possibly execute.
  3. are including jquery library on page prior hook code?
  4. do have hook code wrapped in $(document).ready(function(){ ... } block? if so, won't execute until after page has loaded, , check happening while page loading.
  5. does dialog library require page ready before can call it? try changing label text to:

<script> $(document).ready(function(){   settimeout(function(){     checksalemen();   },5000); }); </script> 

you can tweak later, waits page ready, , additional 5 seconds before tries check.


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -