c# - Passing jQuery Selectors to a function Server side -


i want pass jquery selectors javascript function server side.
here javascript function :

     function disableoperations(selector) {         alert(selector);          $(selector).parent().find('input').attr('disabled', true);     } 

and server side code :

string selectors = "a:contains('test1') a:contains('test2')"; scriptmanager.registerstartupscript(this, gettype(), "displaymessage", string.format("disableoperations('{0}');", selectors), true) 

this code doesn't work (javascript function doesn't call) because variable selectors contains (').
and when write

string selectors = "a:contains(test1) a:contains(test2)"; 

jquery selector doesn't because argument in 'contains' function in selector should between ' , '.
what solution ?

have tried var sel = eval(selector); ?
first try escaping single quotes. "a:contains(\'test1\') a:contains(\'test2\')"


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -