次のhtml文字列がありcontentString
ます:
var content =
'<div id="content">' +
'<div>' +
'<input name="tBox" id="select" type="checkbox" value="" '+
'onclick="changeView()"> Select for operation' +
'<p style="text-align:right"><a href="#">View details</a></p>' +
'</div>' +
'</div>';
ここで、select
IDでチェックボックスを見つけて、機能でチェックされた属性を追加するにはどうすればよいchangeView()
ですか?
function changeView(m) {
//find the select id from content string
var checkbox = content.find($('#select'+m));
// Apply the checked property on checkbox.
checkbox.attr("checked","checked");
}
前もって感謝します。