Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8198581
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:58:52+00:00 2026-06-07T05:58:52+00:00

I have a jsfiddle here – http://jsfiddle.net/9kKXX/20/ My jQuery function $(function() { $(‘form input[type=text]’).live(‘keyup’,

  • 0

I have a jsfiddle here – http://jsfiddle.net/9kKXX/20/

My jQuery function

$(function() {
    $('form input[type="text"]').live('keyup', function() {
        var val = $.trim(this.value);
        $('form .create-playlist-button').prop('disabled', val.length == 0).click(function(){
            alert('ALERT TITLE HERE');
          });
    });
});​

Requirement

  • Click on dropdown -> enter text -> hit create
    I would like to select the corresponding form elements like title, views etc. This is not happening right now

  • When I click on create, it keeps on alerting again and again, how can I avoid that?

I am very new to jQuery and read couple of places but did not find the solution to it

Thank you

UPDATE
————

Answer by Jeff works in fiddle, but when I put that on my code, it does nothing on click. I put the entire code sample in this fiddle – http://jsfiddle.net/rDe9V/ , please help me understand what shall have been wrong here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T05:58:53+00:00Added an answer on June 7, 2026 at 5:58 am

    There’s a few things going on here. Here is the final fiddle.

    First, You are binding the click event every time the key up event is fired. That means the alert will fire at least once for every character in the playlist title. You need to bind the click even on document ready.

    $(function() {
        $('form input[type="text"]').live('keyup', function() {
            var val = $.trim(this.value);
            $('form .create-playlist-button').prop('disabled', val.length == 0)
        });
        $('form .create-playlist-button').click(function(){
            alert('ALERT TITLE HERE');
        });
    });​
    

    Second, You are using duplicate ids. There are many elements on the page with

    <div id="video-detail">
    

    IDs must be unique. You should change these to classes instead.

    <div class="video-detail">
    

    Third, you can access the title by traversing up the DOM tree to a common ancestor between the clicked button and the title the traverse back down to the title. Assuming you change the IDs to classes, that would look like this:

    $('form .create-playlist-button').click(function(e){
        var title = $(e.target).closest('.video-detail').find('.title').text();
        alert(title);
    });
    

    You can go to my fiddle to see the final product.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jsfiddle here . jQuery $(function() { //var input = $('form :input[type=text]')
I have a fiddle here http://jsfiddle.net/WULsZ/1/ I load jQuery first and the code is
I have my form elements here: <li><div id=formanswer1 class=clonedInput>Answer: <input type=text id=formanswer1 value= /></div></li>
I have a jsfiddle here : http://jsfiddle.net/hhimanshu/eLhLS/1/ Current: On keypress, it keeps on appending
I have a fiddle here - http://jsfiddle.net/hhimanshu/SDr3F/2/ The left pane is already available I
I have a layout setup which can be view here: http://jsfiddle.net/Pn3ts/ It all works
I have a CSS mouseover slider fully functional here http://jsfiddle.net/gU4sw/13/ . When I add
I have a jsFiddle here : http://jsfiddle.net/ZXDYS/22/ I am creating Blogger post summaries using
http://jsfiddle.net/JamesKyle/y7hBQ/ I'm making a simple jquery counting function that adds the following classes: First
I have this jsfiddle http://jsfiddle.net/fwQq4/19/ Here I have the wrapper class ( div.wrapper )

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.