Click here to Skip to main content
15,909,822 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am very new to JQuery and am trying to perform a button click after a transaction is succesful.
JavaScript
function NewTxOkay() {
                  $get("btnSearch").click();
              }
      </script>

When the line $get("btnSearch").click();
is run I get an error Microsoft JScript runtime error: 'null' is null or not an object

The NewTxOkay function is called from here:
PHP
<asp:Button ID="btnAddNew" runat="server" Text="Create Tx"/>
            <AJAX:ModalPopupExtender ID="ModalPopupExtender1" BackgroundCssClass="ModalPopupBG"
                 runat="server" CancelControlID="btnCancel" OkControlID="btnOkay" TargetControlID="btnAddNew"               
                PopupControlID="Panel1" Drag="true" PopupDragHandleControlID="PopupHeader"  önOkScript="NewTxOkay();">

Any help would be greatly appreciated
Posted
Updated 22-Aug-12 11:02am
v2

1 solution

You meant to do $("#btnSearch").click() I think.
 
Share this answer
 
Comments
Ryanm1324 22-Aug-12 11:56am    
I tried that just now and it still gives me Microsoft JScript runtime error: 'null' is null or not an object
Christian Graus 22-Aug-12 11:59am    
Do you have a button called btnSearch ? Does it call javascript methods that could be creating this error ? Have you debugged it in Chrome ? jquery should never give this error, it should just do nothing if the button is not there ( it is there, right ? )
Ryanm1324 22-Aug-12 12:02pm    
The button is there. It calls a click event in the codebehind which just has gridview.databind();
Christian Graus 22-Aug-12 12:04pm    
And if you debug in Chrome ?
Ryanm1324 22-Aug-12 12:04pm    
Ive never done that. What do I need to do

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900