Change the size of input with jquery

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?

Answers


You can use the .attr method:

$('#input_2_2').attr('size',60);

$("input_2_2").attr("size", "60");


Use this:

$("#input_2_2").attr("size", "60");

I believe that should work..


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.


Need Your Help