Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript [Solved[ jquery .focus() issue

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #30610
    mjohnson025
    Member

    Hi, I’m trying to append and prepend brackets onto the item in focus, but getting a syntax error. i’ve tried searching elsewhere before asking, but haven’t come up with anything yet.

    $(‘:text’).focus(function(){
    $(this).append(‘);
    $(this).prepend(‘);
    })

    #77682
    jamygolden
    Member

    Could you explain what exactly this would be used for? Is this for items in a textbox or just text in general?

    #77683
    mjohnson025
    Member

    the goal is to add brackets around the text inputs when they are in focus.

    #77685
    jamygolden
    Member

    I think it would be something like this:

    $("input[type='text']").focus(function(){
    $(this).before("image-left.jpg").after("image-right.jpg");
    });

    #77688
    mjohnson025
    Member

    dude, you rock! Thank you.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.