Navigation

10/30/2013

Using jQuery to dynamically control HTML

Have a web page with separate Windows and Apple instructions, want to only show Apple links on Apple laptop, etc.

First have link to jQuery:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script>


Then you can use jQuery hide & show functions, remember to put these functions AFTER the target class or id, otherwise it will not have any effect.

<script>
$(".1class_name").hide();
$("#1id_name").show();

</script>

 You could do all P tags  ("p"), one class  (".this-class") , or one id  ("#one_id")



From w3schools.com

No comments:

Post a Comment