javascript - Get current clicked element id -
Is it possible to get current input element ID by clicking function from the many input fields, all input fields have the same class name but IDs are specific. Like:
type = "checkbox" name = "myCheckboxes []" class = "chkTag" id = chkBox1 "value =" 1 "/> input type =" checkbox "name =" myCheckboxes [] " Class = "chkTag" id = chkBox2 "value =" 2 "/> & lt; Input type = "checkbox" name = "myCheckboxes []" class = "chkTag" id = chkBox3 "value =" 3 "/> gt; input type =" checkbox "name =" myCheckboxes [] "class =" chkTag "id = ChkBox4 "value =" 4 "/> & Lt; Input type = "checkbox" name = "myCheckboxes [class =" chkTag "id = chkBox5" value = "5" /> & lt; Script type = "text / javascript" & gt; $ (Document). (Function () ($ ('input # chkBox1'). ('Change', function () {$ ('input # chkBox1') No. (this) .prop ('check', wrong);});} );But its work for chkbox1. Onclick event for any input field is not working on fire.
id = chkBox1 " html
input type =" checkbox "name = "MyCheckboxes []" class = "chkTag" id = "chkBox1" value = "1" /> input type = "checkbox" name = "myCheckboxes []" class = "chkTag" id = "chkBox2" Value = "2" /> input type = "checkbox" name = "myCheckboxes []" class = "chkTag" id = "chkBox5" value = "5" /> < ('Change', function () {warnings (this. Id)});
Comments
Post a Comment