开发者

How to make the style is applied

How to make the style is applied only to the chosen object, and not all at once?

 $('#add_text').mousedown
        (
            func开发者_开发问答tion() 
            {                              
                $('#add_text').css('background-color', 'blue'),                               
    $('#template').prepend('<div id="text_frame"><input class="input_text"/></div>'),

                $('div#text_frame').attr("class", function (arr) {return "nomber" + arr;}),

                $('div#text_frame').mousedown(function(){$('div#text_frame').addClass('select_text_frame');}),

                $('#text_frame').draggable('enable'), 
     $('#text_frame').draggable({containment: '#template', distance: 1});     
            }       
        ); 


You can do the following to modify only the element that invoked the event in JQuery:

$(document).ready(function() {

    $('#add_text').mousedown(function() {

        // the this keyword references the element where the mousedown
        // event has occurred
        $(this).css(...);

    });

});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜