Jquery 如何检查字符串是否被括号包围?

Jquery 如何检查字符串是否被括号包围?,jquery,Jquery,在我的spring项目中,我有一个仪表板页面,其中一些链接应该在弹出窗口中打开,而一些链接不应该打开。现在,我有了这个代码: $('document').ready(function(){ $( ".dialog" ).dialog({ autoOpen: false, show: { effect: "fadeIn", duration: 1000 }, hi

在我的spring项目中,我有一个仪表板页面,其中一些链接应该在弹出窗口中打开,而一些链接不应该打开。现在,我有了这个代码:

$('document').ready(function(){
    $( ".dialog" ).dialog({
          autoOpen: false,
          show: {
            effect: "fadeIn",
            duration: 1000
          },
          hide: {
            effect: "fadeOut",
            duration: 1000
          }
        });

    $('a').click(function(e){
        if($(this).attr('href') != '<c:out value="${pageContext.request.contextPath}/logout"/>') {
                var id_dialog_div = Math.floor(Math.random() * 1000000);
                var dialog_div = $('<div id="'+id_dialog_div+'" class="dialog" title="Basic dialog"> <p> <span id="text'+id_dialog_div+'"></span> </p> </div>');
                $("#container").append(dialog_div);
                e.preventDefault();
                $.get($(this).attr('href'), function(data){
                    var $temp  = $('<div/>', {html:data});
                    $( dialog_div ).dialog({ title: $temp.find('title').text() });
                    $('#text'+id_dialog_div).html($temp.remove('head').html());
                    $( dialog_div ).dialog({ height: 720 });
                    $( dialog_div ).dialog({ width: 720 });
                    $( dialog_div ).dialog( "open" );
                });
        }
    });
});
$('document').ready(函数(){
$(“.dialog”).dialog({
自动打开:错误,
展示:{
效果:“法登”,
持续时间:1000
},
隐藏:{
效果:“淡出”,
持续时间:1000
}
});
$('a')。单击(函数(e){
if($(this.attr('href')!=“”){
var id_dialog_div=Math.floor(Math.random()*1000000);
变量对话框_div=$('

'); $(“#容器”).append(对话框#div); e、 预防默认值(); $.get($(this.attr('href'),函数(数据){ var$temp=$('',{html:data}); $(dialog_div).dialog({title:$temp.find('title').text()); $('#text'+id_dialog_div).html($temp.remove('head').html()); $(dialog_div).dialog({height:720}); $(dialog\u div).dialog({width:720}); $(dialog_div).dialog(“打开”); }); } }); });
我需要修改此代码,以验证不仅是一个特定的页面,但如果链接是由括号包围,这将表明链接应在弹出窗口中打开


有人知道怎么做吗?

也许可以尝试使用“(“and”)的ascii字符(40和41)来查找它们。 我不知道语法会是什么(我用java而不是jquery编程),所以这是用伪代码编写的,但您可以尝试以下方法:

String string_link = "link"

If ascii(character 1 of string_link) = 40 && 
ascii(last character of string_link) = 41 then boolean popup = true
我知道这可能不是您想要的答案,但希望它能帮助您

FYI
$('document')
返回空对象。幸运的是,jQuery处理ready伪事件时有一个承诺,但它应该是
$(document)