Total members 11894 |It is currently Fri Nov 22, 2024 12:41 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





Change CSS Properties from JavaScript-JQuery
html code
<html>
<head>
<title>Change CSS Properties</title>

<!--
 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
 Note you can download the JQuery package instead of using Google version. --> 
<script src="jquery-1.8.3.js"></script>
<script>
 
$(document).ready(function(){
  $("button#b1").click(function(){
    $("p#p1").css({"background-color":"red","width":"500px","height":"160px"});
  });
  
    $("button#b2").click(function(){
    $("p#p2").css({"background-color":"yellow","font-size":"xx-large"
    ,"color":"blue","height":"200px","border":"1px solid"});
    
     
  });
  
  
});
</script>
<style type="text/css">
.class1
{
font-size:xx-large;
font-weight:bold;
background:#BC6201;
height:400px;
width:400px;
text-align:center;
text-decoration: underline;
color:blue;
}
 
.class2
{
color:red;
background:#52F201;
height:400px;
width:400px;
}


</style>
</head>
<body>

<p id="p1"  class="class1">This paragraph is affected by CSS class1</p>
<p id="p2" class="class2">This paragraph is affected by CSS claas2</p>
  
<br>
<button  id="b1">Change CSS of first paragraph</button>
<button   id="b2">Change CSS of second paragraph</button>
 
</body>
</html>




_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : Change CSS Properties from JQuery
 Change the properties of div tag     -  
 Change the content of select tag using JQuery     -  
 links CSS properties     -  
 Java properties utility     -  
 Class static properties     -  
 demonstrate how to add lighting and material properties     -  
 Changing the color and properties of the header tag     -  
 Define boolean Class properties     -  
 simple code to read properties in java     -  
 JFrame properties for an Applet to be embedded in website?     -  



Topic Tags

JQuery Content






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com