How can I create a clickable link when no results are found

Joey Lea's Avatar

Joey Lea

10 Jan, 2012 03:23 PM

I've tried adding the link with html in the HTML code after


  • I've also tried calling a window.location function upon clicking ...

I can't get it the link to work, it shows up as a link and if you hover it shows where the page should be relocated too but it does not work...

I'm no expert on javascript.

Any help?

  1. 1 Posted by Joey Lea on 10 Jan, 2012 03:27 PM

    Joey Lea's Avatar

    results_ul.html('<li class="as-message">'+opts.emptyText+'</li><li class="as-message"><a href=addlabels>Request New Label Be Added</a></li>');

    Thats my first try...

    I also tried to create a function that directs the window.location to a new page upon click.. no luck, anyone figure this out?

  2. 2 Posted by Jo on 31 Jan, 2012 07:07 PM

    Jo's Avatar

    Hi

    I made emptyText like this:

    emptyText: "No Results Found (add this tag or clear text)",

    Then I created two jquery delegate functions:

    $("body").delegate("a.no-result-add", "mousedown", function(e) {

                $(this).parent().parent().parent().siblings(".as-selections").children().each(function(idx) {
                    if ($(this).attr("class") == "as-original") {
                        $(this).children(".as-input").each(function(idx2) {
                        console.log($(this).val());
    
                            // add tag to db and then repopulate .....
    
                        });
                    }
                });
                alert("add tag ...");
            });
            $("body").delegate("a.no-result-remove", "mousedown", function(e) {
                var lnk = $(this);
                $(lnk).parent().parent().parent().siblings(".as-selections").children().each(function(idx) {
                    var li = $(this);
                    if ($(li).attr("class") == "as-original") {
                        $(li).children(".as-input").each(function(idx2) {
                            $(this).val("");
                            console.log($(this).val());
                        });
                    }
                });
            });
    

    A good place to start perhaps?

  3. 3 Posted by kerbabettybeK on 22 Nov, 2012 10:58 AM

    kerbabettybeK's Avatar
  4. 4 Posted by SauffBrardory on 05 Dec, 2012 02:00 PM

    SauffBrardory's Avatar
  5. 5 Posted by Enewlyintedly on 05 Dec, 2012 02:02 PM

    Enewlyintedly's Avatar
  6. 6 Posted by chepliemiurer on 05 Dec, 2012 02:11 PM

    chepliemiurer's Avatar
  7. 7 Posted by DymnSandReddy on 05 Dec, 2012 02:12 PM

    DymnSandReddy's Avatar

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac