I have this:
$(document).ready(function () {
$("#result").load("file.html *HERE*");
});
In HERE I want search only the elements with "fontsize:20pt". Is possible?
Thanks
According to the specs
If there is a selector that can be created for your request, the answer is yes.
$("#result").load("file.html .pt20"); // if there's a class on the object
If not, you can extract the elements after if you have a way to identify them - note we need to use another ajax method - here $.getis used:
$(function() {
$.get("filept.html",function(data) {
$(data).find("p").each(function() {
var fs = $(this).css("font-size"); // note: "20pt" or 26.nnn for computed size
if (parseInt($(this).css("font-size"),10) == 20) {
$("#result").append($(this));
}
});
});
});
load() will still append all the content. Should use other ajax method, e.g $.get()selector
filter()the elements to find those with the matchingfont-sizeset. Alternatively if you know the elements you want, add a class to them and use that class to target them.