简体   繁体   中英

how i can add a id in js on click event

Hey all i am new in java script so please help me out

i have a input tag so what i want is when some body click on input tag so the #helptext will call automatically by js .

how i can achieve this below the demo code and desired result image....

DEMO

i want like this image :- 在此处输入图片说明

please check my updated DEMO bit of change in my markup i need like my current demo

try this :

$(document).ready(function() {
    $("a").click(function(event) {
        $(this).append(event.target.id);
    });
});
$('input').focus(function() {
    $('#helptext').show();
});

Here is the working JSFiddle

http://jsfiddle.net/tn98m/9/

$('#myInput').focus(function() {
  $('#helptext').show();
});

$('#myInput').blur(function() {
  $('#helptext').hide();
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM