开发者

Searchbar not displaying rel tag

I have set a rel tag to display some text in my searchbar. For some od开发者_高级运维d reason it does not show the text on the homepage: http://www.horecavacaturebank.nl/

<input type="text" id="search" title="" name="s" class="text placeholder" rel="Alle vacatures" value="" />
<input type="text" id="near" title="Locatie" name="location" class="text placeholder" rel="Locatie" value="" />

I use the same code on the "Bekijk CV's" page, which is actually working: http://www.horecavacaturebank.nl/cv/

<input type="text" id="search" title="" name="s" class="text placeholder resume-search" rel="CV's zoeken" value="" /

I already spent like 2 hours to fix this and think this is the good time to ask you guys for help. Thanks in advance!

EDIT: It apears that it kinda conflicts with the jquery file. If i delete the following line, the searchbar works, but the slider wont anymore:

<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/jquery-1.4.3.min.js"></script>


@Quentin is right. You should not use a rel attribute for an input element.

You could use a simple bit of jQuery to get the effect you want

$('#search').val('Alle vacatures');
$('#near').val('Locatie');

$('#search, #near').focusin(function(){
    $(this).val('')
});

$('#search, #near').focusout(function(){
    if ($('#search').val() == ""){
        $('#search').val('Alle vacatures');    
    }
    if ($('#near').val() == ""){
        $('#near').val('Locatie');    
    }
});

You set the values, which shows in the input. When you focus in on either input, the value is removed. Once the input loses focus, if there is nothing added to the field, the value is placed back again.

http://jsfiddle.net/2HY7y/


You can try http://code.google.com/p/jquery-watermark/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜