javascript - jquery attribute select on click not working -


i have problem following:

$(document).on("click", ".adm_vid_stcs_refresh_btn['data-ctg-id']", function(){    categories.ctgid = $(this).attr("data-ctg-id");      categories.ctgtype = $(this).attr("data-ctg-type");    categories.ajax(); }); 

when click button class .adm_vid_stcs_refresh_btn the following error:

uncaught error: syntax error, unrecognised expression: ['data-ctg-id']

how can select class attribute jquery?

when using attribute selector has attribute selector have used, attribute name should not not enclosed string literal in '' or ""

 ".adm_vid_stcs_refresh_btn[data-ctg-id]" 

so

$(document).on("click", ".adm_vid_stcs_refresh_btn[data-ctg-id]", function () {     categories.ctgid = $(this).attr("data-ctg-id");     categories.ctgtype = $(this).attr("data-ctg-type");     categories.ajax(); }); 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -