jQquery Get dom modified attribute value
<p>Let's say I modify an attribute value on click with a function like:</p>

<pre><code>$('#dd ul.dropdown li a').click(function(e) {
    var txt = $(e.target).html();
    var langs = $(e.target).text();
    $('#dd .currentlangs').html(txt);
    langs = langs.trim().toLowerCase().replace(/\s+/g, "-");
    $('.currentlangs').attr('data-lang', langs);
});
</code></pre>

<p>And then I want the current attribute value in a keyup function like:</p>

<pre><code>var $input = $('#querysearch');
var dict = $('.currentlangs').attr('data-lang');
$input.on('keyup', function () {
   alert(dict);
});
</code></pre>

<p>Needed value is "dict" variable but doing that I keep getting the initial value when DOM has been loaded. How can I get the current attribute when the keyup function is fired?</p>

<p>Thanks a lot</p>