I have created this bookmarklet to highlight the username and password boxes on a page. I can change the colour of the boxes, but if I try to change the text in the box, it doesn't work:
<a href="javascript:void(var boxes= $(':text, :password');var selectionBox = $(':password');selectionBox.val('password');for(var i = 0; i < boxes.length;i++){if(boxes[i] == selectionBox[0]){boxes.eq(i-1).val('login');}})">Password box highlighter</a>
I have tried .text = ''
, .value = ''
and .val('')
.
Thanks.