English 中文(简体)
如果选择是单一选择,我怎么能够展示。
原标题: how can I get string to be displayed if option is Single Option
  • 时间:2012-01-13 08:58:30
  •  标签:
  • jquery
  • css

我无法做到这一点,但如果用户选择“选择选择选择”,那么它就应当展示“选择”,并隐藏文本框,否则就会展示文字箱,掩盖“选择”。

但是,它不断展示文本框,不管选择什么选择,我不知道为什么。

Jquery:

$( .numberAnswerTxt , context).each(function() {
    var $this = $(this);
    var $noofanswersText =   ;

    if ($questionType ==  Single Option ) {

        $noofanswersText = $("<span class= naRow string  style= display: inline-block; >Single</span><input type= text  class= numberAnswerTxtRow answertxt  style= display: none; >")
                               .attr( name , $this.attr( name ))
                               .attr( value , $this.val())

    } else {

        $noofanswersText = $("<span class= naRow string  style= display: none; >Single</span><input type= text  class= numberAnswerTxtRow answertxt  style= display: inline-block; >")
                               .attr( name , $this.attr( name ))
                               .attr( value , $this.val())

    }

    $noofanswers.append($noofanswersText);

}); 

Css:

.numberAnswerTxtRow{
    float:center;
    width:40px;
    font-size:14px;
    font-weight:bold;
    display:none;
}

.naRow{
    float:center;   
    display:none;
}
问题回答

我认为,你重新寻找工作

alert( $this.val() )

您不能对警报显示的情况进行脱节,你不能使用警报器,警报结果的线索取决于你使用的浏览器。

我建议使用“。 这样,你就能够控制你想要显示的东西。





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

Drop down background url in Safari Issue

selectBox.selectCSS { background: url(/Images/replacementSelectBackground.png) top left no-repeat height:auto; } I have an issue in Safari only where the image is not rendering on top ...

CSS specific for Safari

How do you target specifically safari in css with styles?

Aligning textarea in a form

Ive used the following css code to align my form elements: form { position:relative; } form input { position:absolute; left:11em; } However, the textarea element is not aligned correctly with the ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

CSS problem with page footer

I have defined my page footer in the css file as: #footer { position: absolute; height: 50px; text-align: center; background: #66CCCC; bottom: 0px; left: 0px; width: 100%; height: ...

热门标签