Total members 11895 |It is currently Thu Dec 12, 2024 1:38 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





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>




_________________
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 : 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     -  



cron





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