I have a simple jQuery function below.. I’m interested in dynamically changing the ‘query:FOOTBALL’ attribute with a dynamic page variable. So something like ‘query:PAGE_TITLE’ or PAGE_VAR
I haven’t had any luck get .replace() to work.. I must be overlooking something very simple; What approach do you all take here?
jQuery(function($){
$("#query").tweet({
avatar_size: 32,
count: 4,
query: "FOOTBALL",
loading_text: "searching twitter..."
});
});
I’m not exactly clear on what you’re asking, but I think you want to use a variable instead of a string literal… As
queryis expecting a String, you can use any String value there. So if you have a variable calledmyVarcontaining a string, you can usemyVarin place of the string literal:Or, you could do something like this to use the value entered into an
inputby the user: