简体   繁体   English

Javascript jQuery的商店定位器

[英]Javascript store locator to Jquery

I'm in a bit of a rut. 我有点发情。 I need to figure out how to convert all this code into jquery. 我需要弄清楚如何将所有这些代码转换成jquery。 Since I don't know too much jquery. 由于我不太了解jquery。 http://www.lastyearsloss.com/store/javascript/map.js I'm not sure which lines I can use or which ones change fully. http://www.lastyearsloss.com/store/javascript/map.js我不确定我可以使用哪些行或哪些行可以完全更改。 The main problem is where I'm importing the data from xml. 主要问题是我要从xml导入数据。 If anyone can point me in the right direction that would be awesome! 如果有人能指出我正确的方向,那就太好了! thanks! 谢谢!

How will jQuery fix your importing of data? jQuery将如何修复您的数据导入? jQuery is still Javascript, just with shortcuts. jQuery仍然是Javascript,只是带有快捷方式。 It may make your code shorter to help you fix your problem; 它可以使您的代码更短,以帮助您解决问题。

from

var sidebar = document.getElementById('sidebar');
sidebar.innerHTML = '<p class="caption">No results found.</p>';
var div = document.createElement('li');

to

var sidebarJquery = $('#sidebar')
                      .html('<p class="caption">No results found.</p>');
var divJquery = $('<li/>');

A jQuery object is basically an Array of DOM elements, (with some additional methods), so: jQuery对象基本上是DOM元素数组(带有一些其他方法),因此:

var sidebar = sidebarJquery[0];
var div = divJquery[0];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM