Javascript jQuery Filter by Type Tutorial

Javascript jQuery Filter by Type Tutorial

Javascript jQuery Filter by Type Tutorial

Today’s tutorial builds on yesterday’s Javascript jQuery Traversing Primer Tutorial as shown below …

Javascript brings great things to the client side of web applications. And within this Javascript world a wonderful library of functionality is jQuery.

The jQuery library starts you thinking in a jQuery way, admittedly, but you can mix and match it with traditional Javascript ways, as well if you wish, but just be easy on yourself with the “onload” event functionality, and adopt the jQuery approach, mixing the traditional Javascript in, as needed, rather than the other way around.

Was looking at the jQuery “traversing” functionality … that is, “motoring” your way along the DOM “hierarchy” “tree” of HTML elements, and jQuery is really quite a good way to go, with some things happening on one line of code, that you cannot imagine happening in one line of code, such as …

… to again use jQuery to filter an HTML webpage’s contents, but this time it is more like the tutorial could be called “The Plucking Out” tutorial, because we identify parts of the webpage with similar HTML element type characters via the use of the jQuery find() method to identify HTML elements we “borderize”. You select what you want to “borderize” via a dropdown selection … (“oisval”, below, is the dropdown selection) …

eval('$("body").find("' + oisval + '").css({"color": "red", "border": "2px solid red"})');

… with the one “complication” being the “borderize” of the “body” tag, being as it is the parent to the “find()” method for non-body selections … weirdly, the “complication” solution is to leave out the find() call. By the way, between selections the “document.body.innerHTML” redraw approach is used, just calling on an initial value snapshotted at the “onload” event.

Here’s the HTML(/Javascript)/jQuery source code you could call borderize.html or try the live run. What do you think?


Previous relevant Javascript jQuery Traversing Primer Tutorial is shown below.

Javascript jQuery Traversing Primer Tutorial

Javascript jQuery Traversing Primer Tutorial

Javascript brings great things to the client side of web applications. And within this Javascript world a wonderful library of functionality is jQuery.

The jQuery library starts you thinking in a jQuery way, admittedly, but you can mix and match it with traditional Javascript ways, as well if you wish, but just be easy on yourself with the “onload” event functionality, and adopt the jQuery approach, mixing the traditional Javascript in, as needed, rather than the other way around.

Was looking at the jQuery “traversing” functionality … that is, “motoring” your way along the DOM “hierarchy” “tree” of HTML elements, and jQuery is really quite a good way to go, with some things happening on one line of code, that you cannot imagine happening in one line of code, such as …

… applies some CSS properties to all nested elements (in our case, amounts to a table element made up of one a tag and eight (recent post) img tags (nested in a div)) between a (child) (img) element type or ID and another (parent) (div) element type or ID … as per the eval assisted line of code (where “colis” is derived elsewhere) …

eval('$("img").parentsUntil("div").css({"color": "' + colis + '", "border": "2px solid ' + colis + '"})');

… ends up as a method to “colour code” an action. We use this to style a whole table element when a particular action happens with one cell. You can do this with traditional Javascript as well, but it sure cuts down on coding to do such a task with jQuery.

So we set out to apply a (more than usually concentrated) jQuery approach to the reworking of the “Recent Posts” ideas we’ve been developing at this blog we last talked about with WordPress Recent Post Landing Page Tutorial. So we latched onto what the Crontab/Curl job uses to help this domain’s Landing Page hook into the list of Recent Posts, via the use of an iframe, for what it does, and this suited the task of making a new HTML(/Javascript)/jQuery web application that presents a table of images of these Recent Posts and lets the user click on the one that interests them, taking them to this blog posting in a new window via Javascript’s “window.open()” … my apologies jQuery purists, for this slip up … instigated by the jQuery click() method via …

$("a").click();

… remember that “one” a (link) tag.

We start with these images having no title, and therefore, no (on)mouseover “hover” message usefulness, but jQuery traversing is quick enough to get in there and add this in in the time between the (on)mouseover “hover” and any “click” to activate the new blog posting window … by the way, apologies to all those mobile users without (on)mouseover … lately we’ve been doing quite a bit of this kind of event logic and hope to get back to more genericity soon … but today’s work’s functionality may not work for mobile users.

Stop Press:

Sun come up … sun goes down … we added an “onload” clause to the iframe and worked from here for the mobile scenario to resolve the mobile issue … with reference to the code below the code differences come sunrise plus a bit are jquery_parents_until.html … and so, resuming normal transmission …

Here’s the HTML(/Javascript)/jQuery source code you could call jquery_parents_until.html or try the live run. What do you think?

Used lots of useful links as below … all from that brilliant Open Source helper website StackOverflow … so, thanks (for getting so many of us through those scenarios where we are plain straight “fishing”) …

If this was interesting you may be interested in this too.


If this was interesting you may be interested in this too.

This entry was posted in eLearning, Tutorials and tagged , , , , , , . Bookmark the permalink.

8 Responses to Javascript jQuery Filter by Type Tutorial

  1. space says:

    hello!,I like your writing so so much! proportion we communicate extra about your post on AOL? I require an expert on this area to resolve my problem. May be that is you! Taking a look ahead to peer you.

  2. PureLocal | Australian Business Directory https://www.purelocal.com.au PureLocal is a hugely popular Australian business directory advertising the opening hours , customer reviews , addresses & phone numbers of over 100000 …

  3. wonderful says:

    Thank you for all your valuable labor on this blog. My mom take interest in doing investigations and it’s really easy to understand why. A number of us know all of the lively manner you provide advantageous strategies by means of your blog and inspire participation from visitors on the subject matter then our own princess is undoubtedly studying a lot of things. Take pleasure in the rest of the new year. Your carrying out a first class job.

  4. meritorious says:

    As I site possessor I believe the content matter here is rattling great , appreciate it for your efforts. You should keep it up forever! Best of luck.

  5. plan says:

    I precisely had to thank you so much again. I am not sure the things that I would have taken care of in the absence of the actual advice documented by you over that area. Certainly was a scary matter in my opinion, but taking note of a specialised technique you dealt with that forced me to leap with fulfillment. I will be happier for the assistance and thus wish you really know what a powerful job you happen to be providing training many people all through your webpage. I am sure you have never got to know any of us.

  6. study says:

    Of course, what a splendid website and informative posts, I will bookmark your blog.All the Best!

  7. gambling says:

    Please let me know if you’re looking for a article author for your site. You have some really good posts and I think I would be a good asset. If you ever want to take some of the load off, I’d really like to write some material for your blog in exchange for a link back to mine. Please send me an email if interested. Regards!|

Leave a Reply to https://musiquedepot.ca/ Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>