Switch to full style
JQuery Examples
Post a reply

get HTML elements attributes values using JQuery

Mon Jan 07, 2013 8:37 pm

get HTML elements attributes using JQuery
javascript code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 
Transitional//EN" "http://www.w3
.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>print HTML attributes using JQuery</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").click(function(){

$("div").append($("p").attr("id")+"<br/>");
$("div").append($("p").attr("style")+"<br/>");
$("div").append($("p").attr("width")+"<br/>");
});
});
</script>

</head>
<body>



<p id="infox" style="background:#5454F4;width='100';"
width="200">MY DIV CONTENT</p><br>
<div></div>
<button>Show Attributes</button>
</body>
</html>




Post a reply
  Related Posts  to : get HTML elements attributes values using JQuery
 Get values of Form parameters using JQuery     -  
 vertically and horizontally centering of html elements     -  
 Sort HTML table from JQuery     -  
 add pagination to html page using JQuery     -  
 Get the position of HTML element using JQuery     -  
 checking if a HTML element is visible or hidden under JQuery     -  
 Show hint when focus on html element using JQuery     -  
 lesson3 :XSD Attributes     -  
 change link <a> attributes dynamically     -  
 modulus of two values     -