there i'm not seeing here.. have string-variable elements id:
var sf_new_id = "#sf_widget_choice-32:14.86:1:1"
i string element this('sf_selectedmethod' element):
var anotherid = sf_selectedmethod.attr('id');
then removed last char , add info id, namely last number , '#':
var sf_new_id = anotherid.substr(0, anotherid.length-1); // without last char. sf_new_id = '#'+sf_new_id+'1';
and becomes string described above.
and i'm trying access element jquery this:
$(sf_new_id).addclass("...");
the element id exists, nothing happens. tried hiding element well:
$(sf_new_id).hide();
but still nothing happens.
i put whole element console.debug, , shows empty object:
console.debug($(sf_new_id));
outputs: object[] in console
what missing here?
edit: tried escape-thingy, , seems work, problem how can escape colons , such when info in variable?
you have escape special characters in string, form valid selector.
var sf_new_id = "#sf_widget_choice-32:14.86:1:1"; sf_new_id = sf_new_id.replace(/:/g, "\\:") .replace(/\./g, "\\.") $(sf_new_id).hide();
Comments
Post a Comment