Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to create a custom label control using jquery. i want to add styles and length etc properties using javascript,
Posted
Updated 3-Sep-15 21:54pm
v2
Comments
Suvendu Shekhar Giri 4-Sep-15 2:09am    
Custom controls in ASP.Net is whole different concept.
https://msdn.microsoft.com/en-us/library/zt27tfhy.aspx[^]

What you have tried so far for what you want ?
[no name] 4-Sep-15 3:49am    
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("p").click(function(){
$(this).hide();
$("#test").html("<label for=\"male\" id=\"lblId\">Male</label>");
$("#lblId").attr("width", "500px");
$("#lblId").css({"border-style": "solid", "border-width": "2px"});
});
});
</script>
</head>
<body>
<p>Click me away!</p>
<div id="test"></div>
</body>
</html>
Schatak 4-Sep-15 3:54am    
then what is your problem? where you are stuck ?

1 solution

Google "create element jquery" and you'll find loads of examples

http://code-tricks.com/best-way-to-create-new-elements-using-jquery/[^]

or consult jQuery's own documentation.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900