0
我想設置相同的網址上的click事件不同的元素:如何設置相同的網址不同的元素
$(document).ready(function() {
var realStateBtn = $('#real-estate-center').parent();
var link = $('#real-estate-center > .linkwidth');
var realStateClass = $('.real-estate-center');
var bankOwnedProps = $('#bank-owned-properties > span');
var findYourHomesValue = $('#find-your-homes-value > span');
realStateBtn.css('zIndex', 9999);
realStateBtn.click(function() {
window.location.href='https://realestatecenter.bankofamerica.com/';
});
link.click(function() {
window.location.href="https://realestatecenter.bankofamerica.com/";
});
realStateClass.click(function() {
window.location.href="https://realestatecenter.bankofamerica.com/";
});
findYourHomesValue.click(function() {
window.location.href="http://realestatecenter.bankofamerica.com/tools/marketvalue.aspx";
});
bankOwnedProps.click(function() {
window.location.href="http://realestatecenter.bankofamerica.com/";
});
});
我打電話一些不同的功能此方法:
window.location.href="http://realestatecenter.bankofamerica.com/";
這就是我想要避免的,我只想使用一次。
有什麼建議嗎?
在您想要更改的元素上添加一個通用類? – dave