show/hide div based on URL parameter
Hi guys,
Am a beginner with Jquery and what i want is as follows.
I have a div that should be hidden on default, but when a certain URL parameter is present, then the div is visible.
I am basing the following on this demo : http://sandbox.ajaxcssblog.com/jquery/jquery.url/url-demo.htm
I have the following html
- <div id="display" style="display:hidden;">
<p>test text</p>
<img src="someimage.jpg" />
</div>
And i have the following in the head
- <script type="text/javascript" id="demoscript">
$(function(){
$("#display").text($.url.param("loginstatus") || "... nothing yet");
});
</script>
What i basically want is that when the URL parameter shows index.html?showdiv=yes
then the div should be displayed.
So it would make sense to put an IF statement in the script as well, the only problem is that i cannot or do not understand how i can modify the JS script in such a way that it does just that.
I have tried many variations with IF and ELSE statements but nothing ever seems to work as i am probably missing how to close tags properly etc.
Would anyone be willing to steer me in the right direction?