Find div by given class and data-id

I want to find div by given class and data-id but following line doesn't work (In this example class is lesson and data-id is variable)

$('div.lesson[data-id=' + htag + ']').addClass('underline');

What am I missing?


Full function looks like that

        $('div.course[data-id=' + cid + ']').addClass('underline');
        $('div.lesson[data-id=' + lid + ']').addClass('underline');

Load.. functions are ajax calls. And class must affect content which returned by ajax call. First addclass works but second not.


Try this,

Live Demo

$('div[class=lesson][data-id="' + htag + '"]').addClass('underline');

Need Your Help

Ajax Validation on JSF

ajax jsf richfaces facelets

I want to validate required fields on diferent forms when i push on save (Toolbar.xhtml). How can i do this? Thanks in advance

Dir.entries(directory).reject{|f| .include? f}

ruby dir

dirs=Dir.entries(directory).reject{|f| [".", "..", "images", ".zip"].include? f}

Django's support for translations in Javascript files

javascript django internationalization

I read and followed the instructions in here, but can't seem to see the string in the javascript in the po file.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.