Need help with the Jquery size attribute...?
Hello,
I have a Jquery code which is used to add multiple files dynamically as per the user requirement. But in my window(site page) the width is too less where browse button (input type="file" ) going out of the frame. so please help me in resolving this issue...Please look into below code for the details:
In the below TD tag I can restrict the width of the default file type size, but when on run time for the 2nd file upload the width getting increased. so plz...do the helpfull.....thanks in advance..
<script>
function addRow(tableID) {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
if(rowCount > 9 )
{
alert("You can add only upto 10 documents")
}else
{
if(rowCount < 10)
{
var row = table.insertRow(rowCount);
var cell1 = row.insertCell(0);
cell1.innerHTML = rowCount + 1 + ')';
var cell2 = row.insertCell(1);
var element1 = document.createElement("input");
element1.type = "checkbox";
cell2.appendChild(element1);
var cell3 = row.insertCell(2);
var element2 = document.createElement("input");
element2.type = "file";
element2.id = "field_"+ ((rowCount-0)+(1-0));
element2.name = "file"+ ((rowCount-0)+(1-0));
cell3.appendChild(element2);
}}
}
function deleteRow(tableID) {
try {
var table = document.getElementById(tableID);
var rowCount = table.rows.length;
for(var i=0; i<rowCount; i++) {
var row = table.rows[i];
var chkbox = row.cells[1].childNodes[0];
if(null != chkbox && true == chkbox.checked) {
table.deleteRow(i);
rowCount--;
i--;
}
}
}catch(e) {
alert(e);
}
}
</script>
<tr> <td width="25px"> </td>
<td class="form_rt_td1a " valign="top">Upload Files</td>
<td >
<table id="dataTable" width="205px">
<tr>
<td > 1) </td>
<td><INPUT type="checkbox" name="chk"/></td>
<td><input type="file" id="field_1" name="file1" size="11" />
</td>
</tr>
</table>
<INPUT type="button" value="Add Row" onClick="addRow('dataTable')" />
<INPUT type="button" value="Delete Row" onClick="deleteRow('dataTable')" />
</td>
<td width="25px"> </td>
</tr>