I need to use the jQuery 2.0 in my drupal 7 site, so i have unset two drupal jQuery files and added the latest version of jQuery using this code in my template.php file so it will not affect the views or other core parts(uses Seven theme):
function mytheme_js_alter(&$js){
unset($js['misc/jquery.js']);
unset($js['misc/jquery.once.js']);
drupal_add_js('http://code.jquery.com/jquery-2.0.0.min.js');
}
Everything goes fine but just found that it breaks the tagging auto-complete feature, to solve this problem i wish to remove the jQuery 2.0 and add the jquery.js
and jquery.once.js
file again only when the page is a form that has a ID news_node_form
so i made some change with no luck:
function mytheme_js_alter(&$js){
unset($js['misc/jquery.js']);
unset($js['misc/jquery.once.js']);
drupal_add_js('http://code.jquery.com/jquery-2.0.0.min.js');
function mytheme_form_news_node_form_alter(&$form, &$form_state, $form_id){
drupal_add_js('http://127.0.0.1/drupal7/misc/jquery.js?v=1.4.4');
drupal_add_js('http://127.0.0.1/drupal7/misc/jquery.once.js?v=1.2');
unset('http://code.jquery.com/jquery-2.0.0.min.js');
}
}
Any idea how to solve this problem?