Guide JQuery: Just the Basics - A Primer for the JavaScript Programmer

Free download. Book file PDF easily for everyone and every device. You can download and read online jQuery: Just the Basics - A Primer for the JavaScript Programmer file PDF Book only if you are registered here. And also you can download or read online all Book PDF file that related with jQuery: Just the Basics - A Primer for the JavaScript Programmer book. Happy reading jQuery: Just the Basics - A Primer for the JavaScript Programmer Bookeveryone. Download file Free Book PDF jQuery: Just the Basics - A Primer for the JavaScript Programmer at Complete PDF Library. This Book have some digital formats such us :paperbook, ebook, kindle, epub, fb2 and another formats. Here is The CompletePDF Book Library. It's free to register here to get Book file PDF jQuery: Just the Basics - A Primer for the JavaScript Programmer Pocket Guide.

This targets elements based on the content rather than on the just markup. Since many vendors do not strategically use classes and ids in their markup or use them incorrectly , being able to target the content is sometimes the only way to grab the content you want. Here is some simplified markup of the items table:. There is no difference in the markup here between a periodical and a monograph in the open stacks. The only difference is the location label.

So I can change the label text of just the first holding record with the following jQuery code, using the. Since the only differentiation on the web page between journals and other item types was the format label printed by the OPAC, it would have been much more difficult to write such a script without the contains: selector.

Using jQuery on your website is as simple as loading the jQuery library on your web page like this:. Then you can enter commands in the Developer Tools using jQuery syntax! Besides the powerful syntax for selecting specific elements based on more than just markup, jQuery also uses syntax that should be familiar to anyone who has written CSS or HTML. Often we want a way to style elements or add interactions to elements within vendor tools, but the elements lack the kinds of attributes like classes or ids that we can use to target them with JavaScript.

In this case, we can use jQuery to target those items based on content, and then add classes or ids that will invoke specific CSS rules or JavaScript functions. If we wanted to change the color of the location code on every holding to blue, I could write the following jQuery:. On this page, go ahead and click your jQuerify bookmarklet to add jQuery, and then paste the code above into the Developer Tools. Did it? If we needed to change the color of a lot of different things, we could target the content and add a CSS class, and then add some CSS to make that text blue, like this:.

But in other cases, such as being able to link to a specific spot on the page or running a JavaScript function when a user interacts with the page, an id might be needed. Add the id attribute to that table cell with a value of journal. Adding classes and ids can really help you style vendor tools in ways that are not possible with CSS alone. But there is still more we can do with JavaScript to make our vendor tools better! While many vendor tools allow libraries to change the language of email templates and headings, there is often a lot of microcopy instructional text that is designed to help users that is generated automatically by the vendor tool.

We can use jQuery to rewrite the text of those messages to make them more useful. The first place I used jQuery to change error and status messages was in Illiad, our Interlibrary loan software. When a user successfully placed a request, they would get a status message like this:.

Software engineering, Node.js, JavaScript and startups.

Our Interlibrary Loan specialist came to me asking whether we could do something, because she was getting dozens of phone calls a day asking that very question, almost all from users who had just placed requests. Since the status messages all had the same class,. But I needed to use jQuery to evaluate and change the content.

I swapped out the unhelpful text for a friendlier, more useful sentence. Here is the code I used for Illiad:. Changing out text is simple enough, but some error messages require more. But while following up with a user one day, I stumbled across the following screen:. The language of this error message is not useful, and neither is the menacing red, bold typeface. So I wrote a script to fix it.

Rather than simply changing out text, I needed to add some elements to the DOM to better allow patrons to access immediate help through phone, email, or chat.

I wrote some HTML that I wanted to appear on this page, and used the jQuery append function to add it to an existing element. If you need to add something to the beginning of an element, jQuery has a prepend function as well. This means that the code is a lot easier to write, especially if you are new to JavaScript. Sometimes I want to move an existing element to a new place on the page. Let me show you an example.

Say I have the following list, and I want to move the first list element to the end of the list:.

Go ahead and use the jQuerify bookmarklet to load jQuery on this page, and then paste the code above into your Developer Tools. What did you notice in the list above? I now have an HTML list that looks like this:. Being able to add, remove, and change the order of elements is the cornerstone of modifying vendor tools. Sometimes I need to do more than just change how something looks.

Stay ahead with the world's most comprehensive technology and business learning platform.

Since many vendor tools rely on user interactions, I often want to change the functionality of a system or add additional content based on user input. I want to hide the other results, so that our users will try the first result to see the full text of an article.

But just in case something happens with that first link, like the database being down or the metadata that is passed to the database to identify the appropriate article being incorrect, I want the user to have the option to see the other sources. And so I hide them in an accordion, with a simply worded link that lets users view them when they need to.

The user only needs to click on the link to show the results, and the additional results become visible. When the page loads, I want the list to be hidden, and when a user clicks the text in the div with the id of toggle , I want to show the list and change the text and functionality of the div. The best solution here is to use a conditional statement.

We could do that with the following conditional statement:. The final code for this is below.

Ready to Learn JavaScript and JQuery? - Small Business Trends

Use your jQuerify bookmarklet to load jQuery on the page, and then paste the code below into your Developer Tools:. One other interaction I have built in to the link resolver is a contextual help slideout that appears only if it seems like several of the links in the results are broken.

Since our links open in a new tab or window, the user can come back to the link resolver page and click a different resource. CORS for example is explained in terms of what it is for and then for detail you are expected to consult the web. Where jQuery is used to work with the technology, for example Ajax then there just isn't enough depth.

Download jQuery: Just the Basics - A Primer for the JavaScript Programmer (English Edition)

The final chapter moves on to using PhoneGap. This really is out of place because PhoneGap is more or less an alternative to jQuery Mobile. While you can use jQuery with PhoneGap none of the examples in the book appear to even attempt to.

What little of jQuery this pocket book covers is done reasonably well, but most of the book is on other topics and as a result jQuery has depths that this book just does not even begin to explore. In particular it fails to explain jQuery's Ajax features and it really doesn't go into many of the more interesting ways jQuery lets you process the DOM. If you are hoping that a quick look at this book will bring you up-to-speed on how jQuery is used in web pages.

Target Audience

This book endeavors to provide you with as much up-to-date information as possible regarding jQuery that can be reasonbly included in a book consisting of roughly pages. JavaScript and JQuery. JavaScript Programmer's Reference. Python: Pocket Primer. Java By Comparison Author: Dr. Simon Harrer, Dr.