Reputation: 487
I have two PHP files one called cab.php and another called d3.php , I want to toggle
in the same file this works cab.php the problem is when I call the second file d3.php
function botaod2mostraesconde()
{
$(".wrapd2").toggle();
$(".datad2").toggle();
$(".uploadd2").toggle();
}
here the input button :
<input type="button" value="D3" onclick="location.href = 'd3.php'">
I am looking for a way to toggle from different files. Thanks
Upvotes: 0
Views: 98
Reputation: 8592
You will need to run the JavaScript on the next page (d3.php). You can't execute client side script (JavaScript) on a php page that runs server side which hasn't yet been loaded in the client's browser.
This is based on an edict written in stone eons ago:
Thou shalt not execute client side code before server side code.
This would be akin to Luke attempting to destroy the Death Star before it's been created. Wait for the Death Star, you must. Then use The Force to destroy it.
Run d3.php first, then toggle elements on the page using JavaScript.
Upvotes: 1