In the process of trying to be more efficient I have been learning a bit of JQuery, but obviously don't know enough.
I need a script that will get each checked function $(':checked').each(function() . Then if a hidden field id (combined with this fields alt tag's) title is not equal to this check boxes title to perf开发者_如何转开发orm jquery load.
I could go on with trying to explain this but I would rather show what I mean. If you look at the code below the 2 elements which cannot exist are :alt and :title. If you can see what I'm trying to do then any ideas how I would get it working. Data driven site has left me few alternatives.
function product_analysis_global() {
$(':checked').each(function () {
if ($('#product_quantity_PRI_' + ':alt').title != ':title') {
$('#product_' + ':alt').load(':title');
$('#product_quantity_PRI_' + ':alt').title = ':title';
$('#product_quantity_PRI_' + ':alt').value = ':value';
} else if ($('#product_quantity_PRI_' + ':alt').title != 'http://www.divethegap.com/update/blank2.html') {
$('#product_' + ':alt').load('http://www.divethegap.com/update/blank2.html');
$('#product_quantity_PRI_' + ':alt').title = 'http://www.divethegap.com/update/blank2.html';
} else
return false;
});
}
Many Thanks,
ps. Implementation can be seen here where by the radio buttons and checkboxes should load in the appropriate products. You will need to click on Beginners to load the form. http://www.divethegap.com/update/diving-trips/adventure-training
In the future, please format your code so others can easily read it when asking for help.
Your description isn't exactly clear, and the page you linked to has no radio buttons or checkboxes, but I believe you are looking for:
function product_analysis_global() {
$(':checked').each(function() {
var alt = $(this).attr('alt');
var title = $(this).attr('title');
if ($('#product_quantity_PRI_' + alt).attr('title') != title) {
$('#product_' + alt).load(title);
$('#product_quantity_PRI_' + alt).attr('title', title);
$('#product_quantity_PRI_' + alt).val($(this).val());
} else if ($('#product_quantity_PRI_' + alt).attr('title') != 'http://www.divethegap.com/update/blank2.html') {
$('#product_' + alt).load('http://www.divethegap.com/update/blank2.html');
$('#product_quantity_PRI_' + alt).attr('title', 'http://www.divethegap.com/update/blank2.html');
} else return false ;
});
}
I am a bit lost. On your example page I see no instances of checkboxes or radio buttons? :checked can only be used with these elements. Perhaps you can do a jsfiddle and give a better understanding of what you are trying to achieve?
精彩评论