jazzyy22 jazzyy22 - 1 month ago 4
PHP Question

Automatically click the button for you if there is a date

I have a file called

file.php
which has:

$row2= pg_fetch_array($result2);
$website = 'http://validate/?id='.$newDateString;


<tbody>

<tr>

<td><?php echo'<a href="'.$website.'">'. $row['name']; ?></td>


The code sends to a file named
jasmine.php
the url with the date since jasmine contains a calendar. It sends it when you click on the date which contains a link to jasmine.

Jasmine.php:
<div id="content">
<h2>Hello, Please let me know which date you are looking for </h2>
<div><label style="font-size: 14pt; font-family: Verdana;">Posting Date: </label></div><br />
<input type="text" id="date" value= "<?php echo $_GET['id']?>" class="css-input" placeholder="Posting Date..." readonly="readonly" /><br /><br />

<input type="button" id="validate" value="Let's work!" class="btn" />
<input type="button" id="clear" value="Wanna go Again?" class="btn" />
</div>
<div id="contentarea2" style="display: none;">
<h2>Results:</h2>
<div class="view_alerts">
<table>
<tr>
<td>
Code
</td>
<td>
# Posted
</td>

</tr>
<tbody id="view_alerts_tbody">

</tbody>
</table>
</div>
</div>


In Jasmine, I get the date already written for me from
file.php
, all I need to do is click the button so it could show me a table, is there a way, that it clicks the button on its own if theres a date written, so when I go on that link, it already puts the date and takes me to the table in
jasmine.php

Answer

You can use below JQuery code for your purpose. When page load is completed (i.e. Page is ready)

 jQuery(document).ready(function()
 {
 jQuery("#Your-Button-ID").click();
 });