Я динамически добавляю input
элементов к table
с id
из inputDataElements
.
Эти input
элементы имеют имя deleteAction
:
function renderInputDataRows(inputData) {
var rows = "";
for (var i = 0; i < inputData.length; i++) {
rows += '<tr>' +
// ...
'<td class="rowActions">' + \
'<input type="image" ' + \
' style="position:relative; ' + \
' bottom:-2px; ' + \
' left:-4px; ' + \
' padding-right:2px;" ' + \
' src="images/delete.png" ' + \
' onClick="deleteInputDataRow(' + inputData[i].index + ');"' + \
' name="deleteAction" ' + \
' value="deleteInputDataRow' + inputData[i].index + '"' + \
' size="18,18" ' + \
' border="0" />' + \
'</td>' +
// ...
'</tr>';
}
return rows;
}
Вопрос : Я хотел бы захватить mouseover
события на deleteAction
-по имени input
elements.
У меня есть следующий скрипт jQuery:
$(document).ready(function() {
inputDataElementsRowDeleteActions = $("#inputDataElements input:[name=deleteAction]");
...
inputDataElementsRowDeleteActions.mouseover(function(event) {
alert(event);
});
});
Проблема : я не получаю сообщение alert
при наведении мыши на input
element.
Есть ли способ перехватить событие mouseover
с помощью jQuery, когда элементы добавляются динамически?