JQuery - go down with selector name -


i created code:

$("input[name*='gridview1$ctl02']").each(function () {    if(this.type == 'checkbox'){        if(this.checked == true){            alert("test")         }        else         {            alert("test2")         }     } }) 

its when write $("input[name*='gridview1$ctl02']") need array of ct101,ct102,ct103

enter image description here

i need this:

$("input[name*='gridview1']").find("ct").each ... 

you can simple create selector match element name starts gridview1:

$("input[name^='gridview1']").each(function () {if(this.type == 'checkbox'){if(this.checked == true){alert("test")}else{alert("test2")}}}) 

alternative if want text inputs:

$("input[name^='gridview1'][type='text']").each(function () {if(this.type == 'checkbox'){if(this.checked == true){alert("test")}else{alert("test2")}}}) 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -