Reputation: 694
I have the following input:
<input id="input_2_2"
class="medium"
type="file"
tabindex="4"
size="20"
value=""
name="input_2">
I don't have access to the HTML therefore I would like to apply jQuery to change the size to "60".
Please can someone help?
Upvotes: 6
Views: 30450
Reputation: 82
I used .prop
$('#input_2_2').prop('size',60);
As of jQuery 1.6, the .prop() method provides a way to explicitly retrieve property values, while .attr() retrieves attributes.
Upvotes: 0
Reputation: 3246
use attr();
like this:
<input id="input_2_2" class="medium" type="file" tabindex="4" size="20" value="" name="input_2">
$("#input_2_2").attr("size","60");
or, you can just set the width
of the element, in my opinion it's better.
Upvotes: 1
Reputation: 1800
Use this:
$("#input_2_2").attr("size", "60");
I believe that should work..
Upvotes: 2