Reputation: 39
I want to use a script that permits to show a div (with class="result") on click of an input type="submit" id="calc" button.
Here's the codes:
Google APIs and script
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#calc").click(function(){
$("result").show();
});
});
</script>
Input type="submit"
<input id="calc" type="submit" name="submit" value="Submit">
Div with class="result"
<div class="result" align="center">
<form>
<textarea readonly="readonly" class="area" rows="6" cols="100" onclick="this.focus();this.select()"><?php
echo "<div style=\"width: 700px; padding: 10px; border: 5px groove #DD670F\"><p align=\"center\">[color=#DD670F][size=14]<strong>";
echo $title;
echo "</strong>[/size][/color]<br><br>";
echo "<img width=\"100%\" src=\"";
echo $img;
echo "\"></p>[color=#DD670F]<b>Titolo:</b>[/color] ";
echo "$title<br>";
echo "$seriesok $series $seriesbr";
echo "[color=#DD670F]<b>Autore:</b>[/color] ";
echo $autor;
echo "<br>[color=#DD670F]<b>Lingua:</b>[/color] ";
echo $language;
echo "<br>[color=#DD670F]<b>Tags:</b>[/color] ";
echo $tags;
echo "<br>[color=#DD670F]<b>Trama:</b>[/color] ";
echo $plot;
echo "<br><br>[color=#DD670F]<b>Image Preview:</b>[/color]<br>";
echo "[SPOILER]";
echo $imgpreview;
echo "[/SPOILER]<br>";
echo "[color=#DD670F]<b>Download Link:</b>[/color] [URL=";
echo $dllink;
echo "]<u>Download</u>[/URL]</div>";
?>
</textarea>
</form>
</div>
On CSS
.result {
display: none;
}
Thanks!
Upvotes: 3
Views: 316
Reputation: 139
Your problem solution is replace this line
$("result").show();
to
$(".result").show();
Upvotes: 0
Reputation: 441
$("#calc").on("click", function(e){
e.preventDefault();
$(".result").show();
});
Upvotes: 0
Reputation: 29683
Since it is class you are referring you should use .
before result
:
$("#calc").click(function(){
$(".result").show();
});
Upvotes: 0
Reputation: 6031
use below code
$(".result").show();
Use .
selector for class element
NOTE : if your button input type is
submit
then page will be redirect to a other page or same page as per action set in form tag
use input type as button
<input id="calc" type="button" name="submit" value="Submit">
Upvotes: 2