jak mogę pobrać wartość id pola input albo select w które aktualnie klinkełem ? pobranie wartości pola value nie ma problemu bo bedzie to
$(this).val()
niestety nie wiem jak pobrać wartość id z pola w którym aktualnie jestem.
<script type="text/javascript"> $(document).ready(function(){ check(); }); function check() { var x = ["input", "select"]; for(var n = 0; n < x.length; n++) { $(x[n]).click(function () { var text = $(this).attr('id'); text = "#" + text; if(!this.value) { $(text).change(function() { $(text).addClass("bg1"); }); } else { $(text).change(function() { $(text).removeClass("bg1"); }); } }); } } </script>