This topic is locked

click custom button programmatically

4/27/2020 7:31:46 PM
PHPRunner General questions
N
Nir Frumer author

hi all

How can I click a button from javascript on load event

My code works fine when I place it in another button

but, does not work from the javascript onload event.

---

example code:

$( "a[id=Padecimientos"+(pageObj.pageId+4)+"]").css("background","#ffffff");

$( "a[id=Antecedentes
"+(pageObj.pageId+5)+"]").css("background","#ffffff");
pageObj.hideField('padecimientos');

pageObj.hideField('antecedentes');

---
what am I doing wrong?

any help would be appreciated

Admin 4/28/2020

I don't see any code here that would actually click the button. Really confusing.

N
Nir Frumer author 4/28/2020

sorry

this is the button's client before code
the clicking code is:
$( "#initButton_"+(pageid+8) ).click();
this code does click the button from the browser's console,
thanks for the correction.

Admin 4/28/2020

Try this. It will work everywhere.

$("a[id^=initButton]").click();
N
Nir Frumer author 4/28/2020



Try this. It will work everywhere.

$("a[id^=initButton"]).click();



hi

when checking the event code, it gives me the following error:

Error de compilación de Microsoft JScript: Se esperaba ')' in line 8
any idea of what causes it?
thanks in advance,

Admin 4/28/2020

Fixed, try the latest.