set width of control in jquery

Posted by Klbaiju under jQuery on 3/23/2015 | Points: 10 | Views : 299 | Status : [Member] | Replies : 2
Hi

in my application .i want to set width of textbox to 110px;

i tried this command

$('input text').width('110px');

but not working .iam using master page.

how to solve this

Regards

Baiju




Responses

Posted by: Sheonarayan on: 3/23/2015 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
It looks like you are not using proper selector to select the textboxes.

$('input[type$="text"]').width('200px');


Use attribute selector like above and it should work, I tested and its working.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: A2H on: 3/23/2015 [Member] [MVP] Silver | Points: 25

Up
0
Down
use the css class selector like given below

<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-1.11.1.min.js"></script>
<script type="text/javascript">

$(function () {
//Access all textbox using css class
$('.txtcss').width('110px');
});
</script>

</head>
<body>
<input type="text" class="txtcss" />
<input type="text" class="txtcss" />
<input type="text" class="txtcss" />
<input type="text" class="txtcss" />
<input type="text" class="txtcss" />
</body>
</html>


Thanks,
A2H
My Blog

Klbaiju, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response